DarkNeSsOak Posted September 26, 2016 Share Posted September 26, 2016 Hola alguien que me pueda ayudar en un script?, el problema es que encontre un resource llamado rav en mta resources y originalmente el script venia con AddComandHandler, yo trate de borrarselo y colocarle el AddEventHandler y me tira error alguna solucion el server.lua es este Spoiler local respawn = 30 local r function(player) if isTimer(r) then resetTimer(r) outputDebugString("Timer Reset") return end outputChatBox("Todos los vehiculos vacios se respawnearan en 10 ".. respawn.."segundos") 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("Todos los vehiculos vacios han sido respawneados") end,respawn*1000,1) end) addEventHandler("onResourceStart", getRootElement(), player) 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 Link to comment
Sergioks Posted September 26, 2016 Share Posted September 26, 2016 (edited) local respawn = 30 local r function respawnVehicle() if isTimer(r) then resetTimer(r) outputDebugString("Timer Reset") return end outputChatBox("Todos los vehiculos vacios se respawnearan en 10 ".. respawn.."segundos") outputDebugString("Cars Respawning") r = setTimer(function() for _, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do if isEmpty( vehicle ) then resetVehicleIdleTime ( vehicle ) respawnVehicle ( vehicle ) end end outputDebugString("Cars Respawned") outputChatBox("Todos los vehiculos vacios han sido respawneados") end,respawn*1000,1) end) addEventHandler("onResourceStart", getRootElement(), respawnVehicle) 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 Trata con esto Edited September 26, 2016 by Sergioks Link to comment
DarkNeSsOak Posted September 26, 2016 Author Share Posted September 26, 2016 Trate con eso y me tira error, en la consola me coloca SCRIPT ERROR: respawnveh\server.lua:22: unexpected symbol near ). alguna solucion? y no respawnea los autos... Link to comment
aka Blue Posted September 26, 2016 Share Posted September 26, 2016 El error te lo indica correctamente. Elimina la ) de la línea 22... end) Link to comment
Tomas Posted September 26, 2016 Share Posted September 26, 2016 De todos modos eso no funcionaría, daría un stack overflow, renombra la función. Link to comment
DarkNeSsOak Posted September 27, 2016 Author Share Posted September 27, 2016 On 9/26/2016 at 2:02 PM, Tomas said: De todos modos eso no funcionaría, daría un stack overflow, renombra la función. y que nombre le deberia colocar? onExplodeVehicle? Link to comment
Enargy, Posted September 27, 2016 Share Posted September 27, 2016 40 minutes ago, DarkNeSsOak said: y que nombre le deberia colocar? onExplodeVehicle? Cual sea que no sea ese ._. Link to comment
DarkNeSsOak Posted September 27, 2016 Author Share Posted September 27, 2016 1 hour ago, Gaberiel said: Cual sea que no sea ese ._. ok gracias, voy a probar Link to comment
Recommended Posts