Wysłany: 2014-09-25, 20:39
maxerxxl
Wiek: 30 Na forum: 5068 dni Posty: 285
Nick w MP: MaXI
Piwa : 38
Witam, zrobi?em sobie prac? ?mieciarza problem tkwi w tym ?e nie mog? zrobi? ?eby z tablicy wszystkie punkty si? pokazywa?y i jak wjad? w wybrany z nich usuwa si? marker, pr?bowa?em, bawi?em si? ale nie mog? si? z tym upora?.
addEventHandler ( "onVehicleEnter" , root , function( player , seat , jacked )
if getElementData ( source , "smieciarka" ) == 1 then
if seat == 0 then
setElementFrozen ( source , false )
setElementData ( source , "smieciarka_ladunek" , 0 )
setElementData ( source , "pojazd_opis" , "Zape?nienie: 0%" )
outputChatBox ( "* Rozpocz??e? prac? jako Smieciarz!" , player )
for i in pairs ( Punkty ) do
marker = createMarker ( Punkty [ i ] [ 1 ], Punkty [ i ] [ 2 ], Punkty [ i ] [ 3 ], "cylinder" , 6 , 0 , 0 , 255 )
addEventHandler ( "onMarkerHit" , marker , function( el )
destroyElement ( marker [ i ])
end )
end
end
end
end )
// brat starszy maxerxxl, pozwolenie na za?o?enie tematu
Wysłany: 2014-09-25, 21:14
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
nie ma czego? takiego jak "for i in ipairs[...]"
Przyk?ad jak to zrobi? ( wzi?te z mojego prawo jazdy ) :
addEventHandler ( "onClientMarkerHit" , root , function ( element )
if source == marker then
if element == localPlayer then
if getElementData ( element , "PrawoJazdy:B" ) then return outputChatBox ( "Posiadasz ju? Prawo Jazdy Kat.B!" , 255 , 255 , 255 ) end
if liczba == #miejsca then
hp = getElementHealth ( getPedOccupiedVehicle ( element ) )
return triggerServerEvent ( "koniecEgzaminu" , element , tonumber ( hp ) ) end
if liczba == 0 then
outputChatBox ( "Zacz??e? egzamin Prawa Jazdy Kategoria B." , 255 , 255 , 255 )
triggerServerEvent ( "onPlayerStart" , localPlayer )
end
liczba = liczba + 1
marker = createMarker ( miejsca [ liczba ][ 1 ], miejsca [ liczba ][ 2 ], miejsca [ liczba ][ 3 ], "checkpoint" , 1.5 , 255 , 0 , 0 )
destroyElement ( source )
end
end
addEvent ( "onPlayerDestroyMarker" , true )
addEventHandler ( "onPlayerDestroyMarker" , root , function ()
if source == localPlayer then
destroyElement ( marker )
liczba = 0
marker = createMarker ( - 102.2421875 , 1231.9173583984 , 21.94800567627 , "cylinder" , 5 , 255 , 255 , 255 , 0 , 0 )
end
end )
end )
Wysłany: 2014-09-25, 21:28
maxerxxl
Wiek: 30 Na forum: 5068 dni Posty: 285
Nick w MP: MaXI
Piwa : 38
ale mi chodzi aby wszystkie markery kt?re mam dodane w tablicy "Punkty" pokazywa?y si? na mapie i jak wjad? w jaki? z nich marker znika ten w kt?ry wjecha?em.
Wysłany: 2014-09-25, 21:37
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Ah wybacz
markery = {
{ x , y , z }
}
for _ , v in ipairs ( markery ) do
marker = createMarker ( v [ 1 ], v [ 2 ], v [ 3 ], "cylinder" , 1.5 , 255 , 255 , 255 )
setElementData ( marker , "wartosc" , true )
end
addEventHandler ( "onMarkerHit" , marker , function ()
if getElementData ( source , "wartosc" ) then
destroyElement ( source )
end
end )
Wysłany: 2014-09-25, 21:53
maxerxxl
Wiek: 30 Na forum: 5068 dni Posty: 285
Nick w MP: MaXI
Piwa : 38
niestety pierwszy marker jeden marker znika po wjechaniu w niego, ale ten drugi ju? nie.
Wysłany: 2014-09-26, 06:46
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4395 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Spr?buj bez warunku if getElementData[...]
Wysłany: 2014-09-26, 14:46
maxerxxl
Wiek: 30 Na forum: 5068 dni Posty: 285
Nick w MP: MaXI
Piwa : 38
nadal znika pierwszy marker kt?ry jest dodany w tablicy ale drugi ju? nie
Tagi: praca :: smieciarza
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: