Wysłany: 2018-04-24, 14:56
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
Witam mam taki problem i? po wyj?ciu z pojazdu lub zdaniu usuwaj? si? wszystkim pojazdy kt?rzy robi? prawko a powinno usuwa? si? tylko tej osobie co wysiad?a lub sk?czy?a egzamin
Tworzenie pojazdu
local pojazd = {}
local naczepa = {}
addEvent ( "egzamin" , true )
addEventHandler ( "egzamin" , getRootElement (),
function()
instruktor = createPed ( 59 , 0 , 0 , 3 )
if getElementData ( source , "Prawko_A" , true ) then
pojazd [ source ] = createVehicle ( 461 , 1105.22 , 1344.73 , 10.48 , 0 , 0 , 0 )
warpPedIntoVehicle ( source , pojazd [ source ])
warpPedIntoVehicle ( instruktor , pojazd [ source ], 1 )
setElementData ( pojazd [ source ], "vopis" , "Egzamin prawa jazdy kategori 'A'" )
elseif getElementData ( source , "Prawko_B" , true ) then
pojazd [ source ] = createVehicle ( 589 , 1105.22 , 1344.73 , 10.48 , 0 , 0 , 0 )
warpPedIntoVehicle ( source , pojazd [ source ])
warpPedIntoVehicle ( instruktor , pojazd [ source ], 1 )
setElementData ( pojazd [ source ], "vopis" , "Egzamin prawa jazdy kategori 'B'" )
elseif getElementData ( source , "Prawko_C" , true ) then
pojazd [ source ] = createVehicle ( 515 , 1154.35 , 1348.30 , 11.83 , 0 , 0 , 180 )
naczepa [ source ] = createVehicle ( 435 , 1150.33 , 1357.92 , 11.48 , 0 , 0 , 180 )
attachTrailerToVehicle ( pojazd [ source ], naczepa [ source ] )
warpPedIntoVehicle ( source , pojazd [ source ])
warpPedIntoVehicle ( instruktor , pojazd [ source ], 1 )
setElementData ( pojazd [ source ], "vopis" , "Egzamin prawa jazdy kategori 'C'" )
local gracz = getPlayerName ( source )
setElementData ( naczepa [ source ], "vopis" , "Naczepa egzaminu kategori 'C'.\nGracza: " .. gracz )
elseif getElementData ( source , "Prawko_D" , true ) then
pojazd [ source ] = createVehicle ( 431 , 1142.01 , 1349.19 , 10.89 , 0 , 0 , 0 )
warpPedIntoVehicle ( source , pojazd [ source ])
warpPedIntoVehicle ( instruktor , pojazd [ source ], 1 )
setElementData ( pojazd [ source ], "vopis" , "Egzamin prawa jazdy kategori 'D'" )
end
setElementData ( source , "egzamin" , true )
triggerClientEvent ( source , "startEgzamin" , resourceRoot , pojazd [ source ])
end )
usuwanie pojazd?w
addEvent ( "egzaminZdany" , true )
addEventHandler ( "egzaminZdany" , getRootElement (),
function()
if isElement ( pojazd [ source ]) then
destroyElement ( pojazd [ source ])
if isElement ( naczepa [ source ]) then
destroyElement ( naczepa [ source ])
end
destroyElement ( instruktor )
end
setElementData ( source , "egzamin" , false )
warpToSzkolaJazdy ( source )
end )
Wysłany: 2018-04-24, 14:59
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
polaczkos , Gracz w evencie triggerowanym z c-side jest jako client. Zmie? to i zobacz jaki b?dzie wynik.
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2018-04-24, 15:05
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
ale spawn pojazdu i usuwanie jest po stronie serwera
Wysłany: 2018-04-24, 15:18
Atroth
Wiek: 23 Na forum: 3677 dni Posty: 1089
Nick w MP: Atroth
Piwa : 4808
polaczkos , Nie pomyli?em si?, wiem co m?wi?. Gdy u?ywasz triggerServerEvent, gracz po stronie serwera jest jako client.
Podpis
Użytkownik - 10-05-2016
Support Team - 17.06.2017
Moderator - 25.11.2017
Mod-Team - 02.07.2018
Wysłany: 2018-04-24, 16:25
polaczkos
Wiek: 25 Na forum: 4085 dni Posty: 168
Nick w MP: polaczkos
Piwa : 3
zrobi?em tak i dalej nie dzia??
addEvent ( "egzaminZdany" , true )
addEventHandler ( "egzaminZdany" , getRootElement (),
function()
if isElement ( pojazd [ client ]) then
destroyElement ( pojazd [ client ])
if isElement ( naczepa [ client ]) then
destroyElement ( naczepa [ client ])
end
destroyElement ( instruktor )
end
setElementData ( source , "egzamin" , false )
warpToSzkolaJazdy ( source )
end )
[ Dodano : 2018-04-24, 16:44 ]
a tak po stronie clienta wygl?da wywo?anie tej funkcji
addEventHandler ( "onClientPlayerVehicleExit" , getRootElement (),
function()
if getElementData ( localPlayer , "egzamin" , true ) then
zakonczEgzamin ()
triggerServerEvent ( "egzaminZdany" , localPlayer )
end
end )
[ Dodano : 2018-04-25, 17:05 ]
pomo?e kto? ?
Tagi: prawo :: jazdy
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: