Wysłany: 2017-03-01, 15:40
LukaSz11
Wiek: 38 Na forum: 5676 dni Posty: 11
Nick w MP: Luki
Witam, mam pro?b? czy m?g?by mi kto? przekszta?ci? ten ma?y skrypcik tak, ?eby pojazdy automatycznie respawnowa?y si? co 30 sekund zamiast u?ycia komendy? Oraz, ?eby nie by?o ?adnych powiadomie?, ?e ta czynno?? b?dzie/lub jest wykonywana (takie odchudzenie ). Z g?ry dzi?ki, pozdrawiam
local respawn = 30
local r
addCommandHandler ( "rav" ,function( player )
if isTimer ( r ) then
resetTimer ( r )
outputDebugString ( "Timer Reset" )
return
end
outputChatBox ( "RESPAWNING ALL UNOCCUPIED VEHICLES IN " .. respawn .. "SECONDS" )
outputDebugString ( "Cars Respawning" )
r = setTimer (function()
for _ , vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do -- For every vehicle do the following ...
if isEmpty ( vehicle ) then
resetVehicleIdleTime ( vehicle ) -- Reset the vehicle 's idle time
respawnVehicle ( vehicle )
end
end
outputDebugString("Cars Respawned")
outputChatBox("ALL UNOCCUPIED VEHICLES RESPAWNED")
end,respawn*1000,1)
end)
function isEmpty( 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
Wysłany: 2017-03-01, 15:56
amited
Wiek: 26 Na forum: 3714 dni Posty: 1233
Nick w MP: Amited
Piwa : 512
function startt ()
setTimer (
for _ , vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do
if isEmpty ( vehicle ) then
resetVehicleIdleTime ( vehicle )
respawnVehicle ( vehicle )
end
end , 30000 , 0 )
end
function isEmpty ( 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
addEventHandler("onResourceStart", getRootElement(),startt)
Je?eli nie dzia?a to daj db3
Podpis
"amited" napisał/a :
Tagi: skrypt :: respawn :: drobna :: modyfikacja.
Anonymous
Na forum: 245 dni
Posty: 1
Anonymous Koniecznie zajrzyj na: