Wysłany: 2020-03-14, 12:27
pozdrominiek
Wiek: 26 Na forum: 2285 dni Posty: 57
witam co wpisac w markery zeby jak wjedziesz w niego fur? to tepa fure do interioru wraz z toba?
Wysłany: 2020-03-14, 12:36
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
Przyk?ad zastosowania:
local myMarker = createMarker (- 2596.625 , 579.358 , 15.626 , 'cylinder' , 2.0 , 255 , 0 , 0 , 150 ) -- tworzy znacznik
function MarkerHit ( hitElement , matchingDimension ) -- tworzy funkcj ? z argumentami
local elementType = getElementType ( hitElement ) -- pobiera rodzaj elementu
outputChatBox ( elementType .. "wewn?trz markera" , getRootElement (), 255 , 255 , 0 ) -- pokazuje tekst
end
addEventHandler ( "onMarkerHit" , myMarker , MarkerHit ) -- do?? cza zdarzenie onMarkerHit do funkcji MarkerHit
Wysłany: 2020-03-14, 12:45
pozdrominiek
Wiek: 26 Na forum: 2285 dni Posty: 57
przepraszam chodzilo mi o to zeby to zablokowac (wjezdzanie fur? do interioru przez marker)
zeby tylko gracz mogl
Wysłany: 2020-03-14, 12:59
P.Wiśnia
Programista LUA
Wiek: 24 Na forum: 4044 dni Posty: 568
Nick w MP: P.Wiśnia
Piwa : 376
Musisz doda? to na pocz?tku skryptu
if getElementType ( hit ) ~= "player" then return end
Więcej szczegółów
Wystawiono 1 piw(a):pozdrominiek
Wysłany: 2020-03-14, 13:13
pozdrominiek
Wiek: 26 Na forum: 2285 dni Posty: 57
wywali?o skryptP.Wi?nia ,
[ Dodano : 2020-03-14, 13:17 ]
wpisze mi to ktos w kod? stawiam piwko
Kod: local strzalka = dxCreateTexture("strzalka.png")
local marker = dxCreateTexture("marker.png")
local tick = getTickCount()
function getDistance(element)
local x1,y1,z1 = getElementPosition(element)
local x2,y2,z2 = getElementPosition(localPlayer)
local distance = getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
if tonumber(distance) then
return tonumber(distance)
end
return false
end
function dxDrawTextElement(element, text)
if not getElementData(localPlayer, "player:logged") then return end
if isPlayerMapVisible() then return end
local x, y, z = getElementPosition(element)
z = (z+1.3)-math.sin(getTickCount()/500)*0.07
local distance = getDistance(element)
local sx,sy = getScreenFromWorldPosition(x, y, z)
local rootx,rooty,rootz = getCameraMatrix()
if x ~= 0 and y ~= 0 and z ~= 0 and sx and sy and distance < 10 and isLineOfSightClear(rootx,rooty,rootz,x,y,z,false,false,false) then
end
end
function dxDrawImageElement(element)
local x, y, z = getElementPosition(element)
local size = getMarkerSize(element)
local r,g,b = 255,255,255
local distance = 1.3
if size >= 3 then
distance = 1.4
end
z = z+distance-math.sin(getTickCount()/500)*0.07
dxDrawMaterialLine3D(x, y, z+1, x, y, z, strzalka, 1, tocolor(r, g, b))
end
addEventHandler("onClientRender", root, function()
for i,v in ipairs(getElementsByType("marker")) do
if getMarkerType(v) == "cylinder" and getElementDimension(v) == getElementDimension(localPlayer) and getElementInterior(v) == getElementInterior(localPlayer) then
if getElementAlpha(v) ~= 0 then
setElementAlpha(v, 0)
end
local x,y,z = getElementPosition(v)
if x ~= 0 and y ~= 0 and z ~= 0 then
z = z+0.05
local size = getMarkerSize(v)
local text = getElementData(v, "text") or ""
dxDrawTextElement(v, text)
dxSetRenderTarget()
dxDrawImageElement(v)
local r,g,b,a = 255,255,255
if not getElementData(v, "selling") then
dxDrawMaterialLine3D(x, y-1*size, z, x, y+1*size, z, marker, 2*size, tocolor(r, g, b, a), x, y, z+500000000)
end
end
end
end
end)
Wysłany: 2020-03-14, 13:17
Wilq
Wiek: 24 Na forum: 4428 dni Posty: 3410
Piwa : 739
No to zobacz na b??dy, pewnie zmienna elementu si? nie zgadza w funkcji getElementType.
Wysłany: 2020-03-14, 15:11
pozdrominiek
Wiek: 26 Na forum: 2285 dni Posty: 57
problem rozwi?zany, do zamkni?cia
Tagi: markery
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: