Plate Posted July 16, 2012 Share Posted July 16, 2012 como se puede hacer que esto enves de que tengas que poner un comando se respawnee en un determinado tiempo (30 segundos) client: function triggerRespawn() triggerServerEvent ( "respawn", getLocalPlayer() ) end addCommandHandler("vhrespawn",triggerRespawn) server: -------------------------------------------------------------------- --* Command vh respawn system *------------------------------------- --* main_s.lua *---------------------------------------------------- --* Made by kimmis *------------------------------------------------ --* Do not fuckin remove this box *--------------------------------- -------------------------------------------------------------------- function respawn() local accountname = getAccountName (getPlayerAccount(source)) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Moderator" ) ) then outputChatBox("***Respawning ALL Empty Vehicles In 10 Secs, get to your car to keep it***") 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, 10000, 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 Link to comment
~Zeus~ Posted July 16, 2012 Share Posted July 16, 2012 function triggerRespawn() triggerServerEvent ( "respawn", getLocalPlayer() ) end setTimer ( triggerRespawn, 30000, 1 ) -- cada 30 segundos los autos haran un respawn No se si estara bien, es la primera vez que hago una cosa asi Link to comment
iFoReX Posted July 17, 2012 Share Posted July 17, 2012 mm Zeus eso esta casi bien, solo que solo lo seteara una vez, para que sean infinitas veces reemplazas el 1 que pusiste por un 0, prueba con eso plate. Link to comment
BorderLine Posted July 17, 2012 Share Posted July 17, 2012 borra el client side y todo el server side reemplazalo por esto function respawnVehicles() outputChatBox("*Empty vehicles will be respawned in 10 seconds.", root, 255, 255, 0) setTimer(function () local vehicles = getElementsByType ( "vehicle" ) outputChatBox("*Empty Vehicles has been respawned.", root, 0, 220, 20, true) for k, vehicle in ipairs ( vehicles ) do if isEmpty( vehicle ) then respawnVehicle ( vehicle ) end end end, 10000, 1) end setTimer(respawnVehicles, 180000, 0)-- edita el tiempo de diferencia entre cada respawn. Suerte 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
~Zeus~ Posted July 17, 2012 Share Posted July 17, 2012 Gracias, lo tendre en cuenta para la proxima vez Link to comment
Plate Posted July 17, 2012 Author Share Posted July 17, 2012 gracias yakuza funciona de 10 Link to comment
Recommended Posts