Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-03-14, 12:27


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

witam co wpisac w markery zeby jak wjedziesz w niego fur? to tepa fure do interioru wraz z toba?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-14, 12:36


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8


Więcej informacji znajdziesz w Wikipedii MTA:

PL/onMarkerHit


Więcej informacji znajdziesz w Wikipedii MTA:

getPedOccupiedVehicle


Więcej informacji znajdziesz w Wikipedii MTA:

setElementInterior


Przyk?ad zastosowania:
local myMarker createMarker(-2596.625579.35815.626'cylinder'2.025500150) -- tworzy znacznik

function MarkerHithitElementmatchingDimension ) -- tworzy funkcjz argumentami
    local elementType getElementTypehitElement ) -- pobiera rodzaj elementu
    outputChatBoxelementType.."wewn?trz markera"getRootElement(), 255255) -- pokazuje tekst
end
addEventHandler"onMarkerHit"myMarkerMarkerHit ) -- do??cza zdarzenie onMarkerHit do funkcji MarkerHit


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-14, 12:45


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

przepraszam chodzilo mi o to zeby to zablokowac (wjezdzanie fur? do interioru przez marker)
zeby tylko gracz mogl

Postaw piwo autorowi tego posta
 

 
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

Respekt: 100
Respekt: 100

Musisz doda? to na pocz?tku skryptu
if getElementType(hit) ~= "player" then return end


Postaw piwo autorowi tego posta
 

 
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



Respekt: 50

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)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-14, 13:17


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

No to zobacz na b??dy, pewnie zmienna elementu si? nie zgadza w funkcji getElementType.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-03-14, 15:11


pozdrominiek







Wiek: 26
Na forum: 2285 dni
Posty: 57



Respekt: 50

problem rozwi?zany, do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: markery
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Markery Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku