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

Wysłany: 2016-04-04, 10:39


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Witam , tworz? dosy? zaawansowan? prac? lecz mam problem z tworzeniem markera obok baga?nika pojazdu. Chcia?em zrobi? to tak :
Pojazd2 getElementData(localPlayer,"praca_tworzenie_marker3")
local x,y,getElementPositionPojazd2 )
Marker3 createMarker(x,y,z,"cylinder",1.5,255,255,255)


Chcia?em zrobi? np :
createMarker(x+2,y+1,z,"cylinder",1.5,255,255,255)


Ale to nie zadzia?a poniewa? pojazd moze zawsze znajdowa? si? w innej pozycji.

Prosi?bym o funkcje kt?rej mog? u?y? do tego i o przyk?adowe u?ycie jej.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 14:27


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

BlackGamePL, t? funkcja pobierzesz pozycje bagaznika:

Więcej informacji znajdziesz w Wikipedii MTA:

getVehicleComponentPosition

A bagznik ma nazwe: boot_dummy

[ Dodano: 2016-04-04, 14:27 ]
Nazwa: bump_rear_dummy b?dzie chyba lepszym sposobem

[ Dodano: 2016-04-04, 14:48 ]
Marker na b?otnik:

Marker na baga?nik:


Ostatnio zmieniony przez luki123luki123 2016-04-04, 17:37, w całości zmieniany 1 raz  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:33


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Co? chyba ?le zrobi?em , tak wygl?da kod :
addEventHandler("onClientMarkerHit",getRootElement(),
function(el,md,plr)
if source~=Marker2 then return end
if el == localPlayer then
if isPedInVehicle(elthen return end
if (Pojazd2then
    for k in pairs (bump_rear_dummy) do
local xygetVehicleComponentPosition(Pojazd2k)
Pojazd2 getElementData(localPlayer,"rotacja_pojazdu")
setElementFrozen(Pojazdtrue)
destroyElement(Marker2)
destroyElement(blip2)
triggerServerEvent ("karton_magazyn_fabryka",resourceRoot,localPlayer)
toggleControl("enter_exit"false)
toggleControl("sprint"false)
toggleControl("jump"false)
toggleControl("crouch",false)
toggleControl("look_behind",false)
outputChatBox("#33CCCC[Street Life] #FFCC99Podnios?e?/a? karton, zanie? go teraz do samochodu."255255255,true)
Marker3 createMarker(x,y,z,"cylinder",1.5,255,255,255)
end
end
end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:46


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

BlackGamePL, spr?buj ten kod chyba jest bardziej czytelniejszy :0
function przniesc (hitElement)
    if getElementType(hitElement) == "player" then else return end -- Sprawdzanie czy element kt?ry wszedw marker jest graczem
    if source == Marker2 then else return end -- Sprawdzanie czy maker jest odpowiednim markerem
    if isPedInVehicle(hitElementthen return end
    if Pojazd2 then else return end
    local xygetVehicleComponentPositionPojazd2"bump_rear_dummy""world")
    if and and z then else return end
    Pojazd2 getElementData(hitElement"roatacje_pojazdu") -- Nie wiem o co w tym chodzi ;)
    setElementFrozen(Pojazdtrue)
    destroyElement(Marker2)
    destroyElement(blip2)
    triggerServerEvent ("karton_magazyn_fabryka",resourceRoot,localPlayer)
    toggleControl("enter_exit"false)
    toggleControl("sprint"false)
    toggleControl("jump"false)
    toggleControl("crouch",false)
    toggleControl("look_behind",false)
    outputChatBox("#33CCCC[Street Life] #FFCC99Podnios?e?/a? karton, zanie? go teraz do samochodu."255255255,true)
    Marker3 createMarker(x,y,z,"cylinder",1.5,255,255,255)
end
addEventHandler("onClientMarkerHit",getRootElement(),przniesc )



A to tw?j z poprawkami :)

addEventHandler("onClientMarkerHit",getRootElement(),
function(el,md,plr)
if source~=Marker2 then return end
    if el == localPlayer then
    if isPedInVehicle(elthen return end
    if (Pojazd2then
local x,y,getVehicleComponentPosition Pojazd2"bump_rear_dummy""world" )
Pojazd2 getElementData(localPlayer,"rotacja_pojazdu")
setElementFrozen(Pojazdtrue)
destroyElement(Marker2)
destroyElement(blip2)
triggerServerEvent ("karton_magazyn_fabryka",resourceRoot,localPlayer)
toggleControl("enter_exit"false)
toggleControl("sprint"false)
toggleControl("jump"false)
toggleControl("crouch",false)
toggleControl("look_behind",false)
outputChatBox("#33CCCC[Street Life] #FFCC99Podnios?e?/a? karton, zanie? go teraz do samochodu."255255255,true)
Marker3 createMarker(x,y,z,"cylinder",1.5,255,255,255)
end
end
end
end)


PS: bardzo namieszane jest w tym skrypcie raz u?ywasz po if'ie return end a raz ciagniesz to po ca?ej funkcji ;)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:52


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Co? jest nie tak , po wej?ciu w marker nic si? nie dzieje :(

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:55


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

BlackGamePL, kt?rego kodu u?y?e? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:55


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Tego pierwszego

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:57


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

BlackGamePL, czyli mojego ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 17:58


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

tak tak

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 18:09


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

BlackGamePL, a wi?c tak jaki ty masz model samochodu pod kt?rym chcesz ten marker zrobi? ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 18:15


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Je?eli chodzi ci o id to - 499

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 18:20


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

BlackGamePL, u mnie ten kod dzia?a idealnie:
function przniesc (hitElement)
    if getElementType(hitElement) == "player" then else return end -- Sprawdzanie czy element kt?ry wszedw marker jest graczem
    if source == Marker2 then else return end -- Sprawdzanie czy maker jest odpowiednim markerem
    if isPedInVehicle(hitElementthen return false  end
    if Pojazd2 then else return end
    local xygetVehicleComponentPositionPojazd2"bump_rear_dummy""world")
    Pojazd2 getElementData(hitElement"roatacje_pojazdu") -- Nie wiem o co w tym chodzi ;)
    setElementFrozen(Pojazdtrue)
    destroyElement(Marker2)
    destroyElement(blip2)
    triggerServerEvent ("karton_magazyn_fabryka",resourceRoot,localPlayer)
    toggleControl("enter_exit"false)
    toggleControl("sprint"false)
    toggleControl("jump"false)
    toggleControl("crouch",false)
    toggleControl("look_behind",false)
    outputChatBox("#33CCCC[Street Life] #FFCC99Podnios?e?/a? karton, zanie? go teraz do samochodu."255255255,true)
    Marker3 createMarker(x,y,z,"cylinder",1.5,255,255,255)
end
addEventHandler("onClientMarkerHit"getRootElement(), przniesc )


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-04-04, 18:30


Dexnes_

Tiger






Wiek: 26
Na forum: 4401 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

u mnie po wej?ciu w ten marker nic si? nie dzieje i nie pojawia si? nast?pny na baga?niku pojazdu :/

[ Dodano: 2016-04-05, 22:05 ]
Mo?na zamkn?? , problem rozwi?zany.

Postaw piwo autorowi tego posta
 

 
Tagi: pojawianie :: się :: markera :: obok :: bagażnika
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Pojawianie się markera obok bagażnika 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