Jump to content

Idle vehicle error problem


BennyBunny

Recommended Posts

My script work fine but i get an error when:

PPL go in the vehicle = ok

PPL out of the vehicle =ok

PPL go again in the vehicle =ok

PPL go out again the vehicle then after 10sec vehicle boom = ok

Then when the ppl goes in a other vehicle i get this error:

WARNING: vehicles\rhVMS.lua:52: Bad argument @ 'killTimer'

IDK why :/ Here is my script:

BoomVehicle = {} 
  
  
  
  
function respawnVehicle(vehicle) 
  
    if (BoomVehicle[source]) then 
  
         outputChatBox ("counter is running test funtion", sourcePlayer ) 
  
    else 
  
            outputChatBox ("counter is NOT running test funtion", sourcePlayer ) 
  
        if vehicle == nil then return; end; 
    if getElementType(vehicle) ~= "vehicle" then return; end; 
  
    sx = getElementData(vehicle,"posX"); 
    sy = getElementData(vehicle,"posY"); 
    sz = getElementData(vehicle,"posZ"); 
    rx = getElementData(vehicle,"rotX"); 
    ry = getElementData(vehicle,"rotY"); 
    rz = getElementData(vehicle,"rotZ"); 
     
    spawnVehicle ( vehicle,sx, sy, sz, rx, ry, rz ) 
  
  
    end 
  
end 
  
  
  
  
  
function Playerinvehicle ( sourcePlayer ) 
  
  
local testcount = BoomVehicle[source] 
  
  
    if isPedInVehicle ( sourcePlayer ) then 
  
  
    outputChatBox (" is in a vehicle.", sourcePlayer ) 
  
  
  
        if (BoomVehicle[source]) then 
  
           killTimer ( testcount ) 
  
  
           outputChatBox ("counter is running.", sourcePlayer ) 
         
         else 
  
                    outputChatBox ("counter is NOT running.", sourcePlayer ) 
  
        end 
  
  
     end 
  
end 
  
  
addEventHandler ( "onVehicleEnter", getRootElement(), Playerinvehicle ); 
  
  
  
  
  
  
function ehVehicleExit() 
  
  
        BoomVehicle[source] = setTimer(respawnVehicle, 10000, 1, source)  
  
    if isTimer(BoomVehicle[source]) then -- Check if timer is running using isTimer (this is an example of its use and all) 
  
        outputChatBox ("counter is running exit vehicle.", sourcePlayer ) 
  
    else 
  
                 outputChatBox ("counter is NOT runningexit vehicle.", sourcePlayer ) 
  
    end 
  
         
end 
  
addEventHandler ( "onVehicleExit", getRootElement(), ehVehicleExit ); 

The idle script work fine only this error make me crazy :/

I hope someone can help me with that problem.

Link to comment

Jaysd1, are you blind or what? he has a setTimer.

I think you just don't know anything about his error and you want to increase your post count, if you keep doing that, you'll get a bad reputation.

On topic:

BoomVehicle = {} 
  
function respawnVehicle(vehicle) 
    if (BoomVehicle[source]) then 
        outputChatBox ("counter is running test funtion", sourcePlayer ) 
     else 
        outputChatBox ("counter is NOT running test funtion", sourcePlayer ) 
    if vehicle == nil then return; end; 
    if getElementType(vehicle) ~= "vehicle" then return; end; 
    local sx = getElementData(vehicle,"posX"); 
    local sy = getElementData(vehicle,"posY"); 
    local sz = getElementData(vehicle,"posZ"); 
    local rx = getElementData(vehicle,"rotX"); 
    local ry = getElementData(vehicle,"rotY"); 
    local rz = getElementData(vehicle,"rotZ"); 
    spawnVehicle ( vehicle,sx, sy, sz, rx, ry, rz ) 
    end  
end 
  
function Playerinvehicle ( sourcePlayer ) 
local testcount = BoomVehicle[source] 
    if isPedInVehicle ( sourcePlayer ) then 
    outputChatBox ("is in a vehicle.", sourcePlayer ) 
        if (BoomVehicle[source]) then 
           if isTimer(testcount) then killTimer ( testcount ) end 
           outputChatBox ("counter is running.", sourcePlayer ) 
         else 
            outputChatBox ("counter is NOT running.", sourcePlayer ) 
        end 
    end 
end  
addEventHandler ( "onVehicleEnter", getRootElement(), Playerinvehicle ); 
  
function ehVehicleExit() 
    BoomVehicle[source] = setTimer(respawnVehicle, 10000, 1, source) 
    if isTimer(BoomVehicle[source]) then -- Check if timer is running using isTimer (this is an example of its use and all) 
        outputChatBox ("counter is running exit vehicle.", sourcePlayer ) 
    else 
        outputChatBox ("counter is NOT runningexit vehicle.", sourcePlayer ) 
    end     
end 
addEventHandler ( "onVehicleExit", getRootElement(), ehVehicleExit ); 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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