Jump to content

Duda con 2 Cosas...


Alexs

Recommended Posts

Posted (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 by Guest

Developer @ MYVAL

Posted

1: Te faltan los "end".

2: Te falta el loop.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (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 by Guest

Developer @ MYVAL

Posted
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 ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Developer @ MYVAL

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...