Scripts / [SOLVED] How would I add a timer to this?

Author
Message
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 27th Apr 2022 14:51
Hello!
What I would like to do is have the text up for 2-3 seconds and then this trigger zone is destroyed. I'm scratching me head and have been trying to figure this out for a few hours. Any help is greatly appreciated. Thanks!
---------------------------------------------------------
function foundmoney_init(e)
end

function foundmoney_main(e)
if g_Entity[e]['plrinzone']==1 then

TextCenterOnXColor(50.05,50.05,5,"YOU FOUND SOME MONEY!",0,0,0)
TextCenterOnXColor(50,50,5,"YOU FOUND SOME MONEY!",255,255,255)
Prompt("They will never know you stole it. ") -- put your text here
PlaySound(e,0)
----- Need a timer or something here
Destroy(e)
end
end

The author of this post has marked a post as an answer.

Go to answer
thatandplaygames
4
Years of Service
User Offline
Joined: 12th Feb 2020
Location: In a creative space
Posted: 27th Apr 2022 15:15
This post has been marked by the post author as the answer.
After research, I thank Smallg!

This code works... does it look right?

local wait_duration = 4000
function foundmoney2_init(e)
end

function foundmoney2_main(e)
if g_Entity[e]['plrinzone']==1 then
TextCenterOnXColor(50.05,50.05,5,"YOU FOUND SOME MONEY!",0,0,0)
TextCenterOnXColor(50,50,5,"YOU FOUND SOME MONEY!",255,255,255)
Prompt("They will never know you stole it. ") -- put your text here
PlaySound(e,0)
if GetTimer(e) >= wait_duration then
Destroy(e)
end
else
StartTimer(e)
end

end

Login to post a reply

Server time is: 2024-02-22 03:38:16
Your offset time is: 2024-02-22 03:38:16