Jump to content

Problem with checkpoint waiting state


kuwalda

Recommended Posts

I will try to explain this as simple as possible.

I have made goverment job system and I want to add function to this, that makes player stay calm for 10seconds. If he does, let him see next checkpoint. I have shortened my code for better understanding.

tableOfCheckpoints = { } 
tableOfCheckpoints[1] = { 1, 2, 3 } 
tableOfCheckpoints[2] = { 1, 2, 3 } 
tableOfCheckpoints[3] = { 1, 2, 3 } 
  
--ciga is basicly variable, which holds checkPoint ID in function 
local ciga = getElementData(thePlayer, "govermentJobCheckpointID") 
  
--and then if this ID is smaller than my checkpoint count in table, make next checkpoint 
function jobCheckpointControler(thePlayer) 
if ( ciga < #tableOfCheckpoints ) then 
    setElementData(thePlayer, "checkpoint", createMarker(...)) 
    setElementData(thePlayer, "blip", createBlip(...)) 
    setElementData ( thePlayer, "govermentJobCheckpointID", getElementData(thePlayer, "govermentJobCheckpointID") + 1 ) 
    addEventHandler( "onMarkerHit", getElementData(thePlayer, "checkpoints"), jobCheckpointControler ) --and this starts it all over 
end 
end 

Can someone please briefly can explain how to do it? I think I have to use timer, but how and when - no idea..

Any help would be appriciated.

I tried something like this, but it didn`t work out:

addEventHandler( "onMarkerHit", getElementData(thePlayer, "checkpoints"), setTimer(jobCheckpointControler, 5000, 1) ) 
  

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