Jump to content

setTimer... Got nil?


Sasu

Recommended Posts

addEventHandler("onPlayerVehicleExit", root, 
function(veh, seat) 
    if veh == vehicleBus[source] and getElementData(source, "Ocupacion") == "Chofer de larga distancia" and getElementModel(veh) == 431 and seat == 0 then 
        outputChatBox("Regresa al vehiculo en menos de 40 segundos si no quieres perder la mision.", source, 255, 0, 0) 
        function customTimer(source) 
            if isElement(markerPrice[source]) and isElement(blipPrice[source]) then 
                destroyElement(markerPrice[source]) 
                destroyElement(blipPrice[source]) 
                outputChatBox("Mision fracasada...", source, 255, 0, 0) 
            end 
        end 
        timeLimit[source] = setTimer(customTimer(source), 1000, 1) 
    end 
end 
) 

I have an error with this part:

WARNING: script\script.lua:124: Bad argument @ 'setTimer' [Expected function at argument 1, got nil]

Line 124 = Line 12

The tables and elements are defined. Its works but it is annoying that error.

Link to comment
timeLimit[source] = setTimer(customTimer(source), 1000, 1) 

Change that to:

timeLimit[source] = setTimer(customTimer, 1000, 1, source) 

Arguments go after the setTimer arguments list.

Oh, You're right. I forgot that. Thank you very much.

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...