• Can someone help with with a function?
    4 replies, posted
Basically if player dies (during 'x' function) then wait 'y' amount of time then allow 'x' function again. Could someone write an example of this for me?
what do you mean "during x function"? A function in code runs instantly, and usually is done within the next frame in game. Unless you have something like a co-routine. That runs during gameplay, and can keep run the ONE task, instead of re doing the same task on every frame.
okay so lets say that someone (in a specific darkrp team) is lockpicking an entity and they die while lockpicking the entity. There's only a 30 second cool down until they(the darkrp team) can lockpick it again. Can someone give me an example of that?
oh that would be simple. If you can detect that the lockpicking has been aborted (by what reason ever) (and i am assuming you know how to do that), you can start a simple timer that changes a variable from True to False. As long as its true, people can lockpick it again, as soon as its set to false by the timer, they cant. or they have to retry, whatever you wanna do
isLockpicking = false if LocalPlayer():Alive() then -- I cba to find a way to check if the play is lockpicking, you can probably find it somewhere and make a local variable for it above. isLockpicking = true end if isLockpicking == true then timer.Simple( 2 , function() print( isLockpicking ) -- Obviously you write in here what you want the function to do, (most likely disallowing the player from lockpicking) end) end
Sorry, you need to Log In to post a reply to this thread.