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.