Wysłany: 2015-02-05, 00:00
Daisu
Programista Lua
Wiek: 26 Na forum: 4444 dni Posty: 193
SPONSOR
Nick w MP: Daisu
Piwa : 24
Witam mam startowe auta na spawnie i chcia?bym doda? komend? "respawn" kt?ra respawnowa?a by auta kt?e s? nieu?ywane mam taki skrypt na /setspawn ale chcia?bym ?eby nie respawnowa? wszystkich lecz tylko te kt?re by?y by zawarte w skrypcie.
main_s:
function respawn ()
local accountname = getAccountName ( getPlayerAccount ( source ))
if isObjectInACLGroup ( "user." .. accountname , aclGetGroup ( "Respawn" ) ) then
outputChatBox ( "*** W ci?gu 15 sekund nast?pi respawn pojazd?w zachowaj ostro?no?? ***" )
setTimer (function ()
local vehicles = getElementsByType ( "vehicle" )
for k , vehicle in ipairs ( vehicles ) do
if checkEmpty ( vehicle ) then
local seats = getVehicleMaxPassengers ( vehicle )
resetVehicleIdleTime ( vehicle )
respawnVehicle ( vehicle )
end
end
end , 15000 , 1 )
end
end
addEvent ( "respawn" , true )
addEventHandler ( "respawn" , getRootElement (), respawn )
function checkEmpty ( vehicle )
local passengers = getVehicleMaxPassengers ( vehicle )
if type ( passengers ) == 'number' then
for seat = 0 , passengers do
if getVehicleOccupant ( vehicle , seat ) then
return false
end
end
end
return true
end
function respawn1 ( thePlayer , command )
local x , y , z = getElementPosition ( thePlayer )
local vehicle = getPedOccupiedVehicle ( thePlayer )
if vehicle then
local spawnVeh = setVehicleRespawnPosition ( vehicle , x , y , z )
if spawnVeh then
outputChatBox ( "Spawn pojazdu ustawionio!" , thePlayer )
else
outputChatBox ( "Error" , thePlayer )
end
else
outputChatBox ( "Najpierw wsiadz do pojazdu!" , thePlayer )
end
end
addCommandHandler ( "setspawn" , respawn1 )
main_c:
function triggerRespawn ()
triggerServerEvent ( "respawn" , getLocalPlayer () )
end
addCommandHandler ( "respawn" , triggerRespawn )
Mety chyba nie musz? dawa?
Wysłany: 2015-02-05, 07:21
MeeShuffle
Programista/Grafik
Wiek: 32 Na forum: 4394 dni Posty: 2758
Nick w MP: Shuffle
Piwa : 8575
Wysłany: 2015-02-05, 08:59
PolskiSebek12
Programista
Wiek: 28 Na forum: 4347 dni Posty: 343
Nick w MP: CrosRoad95
Piwa : 3883
widz? ?e robisz 1 podstawowy b??d. po stronie servera w funkcji kt?ra obs?uguje zdarzenie wszystkie: source, zamienie? na client oraz dodaj: if client == source then
Wysłany: 2015-02-05, 16:59
Wittx
8===D
Wiek: 26 Na forum: 4794 dni Posty: 121
Nick w MP: wittula
Piwa : 1905
Po co kombinujecie?
Jako drugi argument podaj resourceRoot i po problemie.
Tagi: startowe :: auta :: ich :: restart.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: