Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Example 1: delay
- function main()
- local t -- defaults to nil without a specified value, this just declares it as local
- while true do
- if t and GetTimer() >= t + 3000 then -- if t is not nil and the timer is 3000ms past t...
- TextPrintString("pointless delay thingy works",3,1)
- t = nil -- make it nil again
- elseif IsButtonBeingPressed(3,0) and not t then -- if button is pressed and t is nil...
- t = GetTimer() -- set t to the current time
- end
- Wait(0)
- end
- end
- -- Example 2: opportunity
- function main()
- TextPrintString("Get ready...",10,1)
- Wait(math.random(2000,10000))
- local t = GetTimer()
- while GetTimer() < t + 1000 do -- while the time is less than 1000ms past the start time...
- TextPrintString("NOW!",0,1) -- print text
- Wait(0) -- show text and let bully process buttons
- if IsButtonBeingPressed(3,0) then -- check if the nigga pressed it
- MissionSucceed()
- end
- end
- MissionFail()
- end
Advertisement
Add Comment
Please, Sign In to add comment