Alexs Posted April 25, 2012 Posted April 25, 2012 (edited) function respawnenagua ( ) local autos = getElementsByType ( "vehicle" ) if isElementInWater(autos) then respawnVehicle ( autos ) end addEventHandler ( "onResourceStart", getRootElement(), respawnenagua ) Hola a Todos, tengo 2 dudas con este script: 1- Como hago para que el resource revise el element cada 10 segundos y que solo lo haga si lleva 30 segundos vacio (sin pasajeros o conductor) y en el agua? 2- Soy Yo o esto haria respawnear todos los vehiculos por que uno este en el agua? Edited April 25, 2012 by Guest
Alexs Posted April 25, 2012 Author Posted April 25, 2012 (edited) 1: Te faltan los "end".2: Te falta el loop. Loop??.... algo asi? for theKey,player in ipairs(getElementsByType ( "vehicle" )) do o no? Edited April 25, 2012 by Guest
Castillo Posted April 25, 2012 Posted April 25, 2012 function respawnenagua ( ) local autos = getElementsByType ( "vehicle" ) for index, auto in ipairs ( autos ) do if isElementInWater ( auto ) then respawnVehicle ( auto ) end end end addEventHandler ( "onResourceStart", resourceRoot, respawnenagua )
Alexs Posted April 25, 2012 Author Posted April 25, 2012 function respawnenagua ( ) local autos = getElementsByType ( "vehicle" ) for index, auto in ipairs ( autos ) do if isElementInWater ( auto ) then respawnVehicle ( auto ) end end end addEventHandler ( "onResourceStart", resourceRoot, respawnenagua ) Ah ok, gracias, es un comienzo, vere lo del vehiculo vacio y les timer, pero quiero intentarlo por mi mismo... Mi 2º intento: function respawnenagua ( thePlayer, seat, jacked ) local autos = getElementsByType ( "vehicle" ) for index, auto in ipairs ( autos ) do if isElementInWater ( auto ) then setTimer(respawnVehicle, 30000, 1, auto) end end end addEventHandler ( "onVehicleExit", getRootElement(), respawnenagua ) Vere si esto resulta, deberia verdad? Todo Funcional, pueden cerrar el tema
Recommended Posts