Spc Posted July 3, 2017 Share Posted July 3, 2017 Sorry for my English. I wonder how to do an countdown timer? Eg from 2 minutes. Thanks in advance. Link to comment
Slim Posted July 3, 2017 Share Posted July 3, 2017 (edited) Here's a server sided example: function ShowCountdown () local accountname = getAccountName ( getPlayerAccount ( player ) ) --Grabs the users account name if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "SuperModerator" ) ) then --Checks if the user account name's in the ACL group (SuperModerator). --You could put something here for when the timer starts. --Start of timer script setTimer ( function ( ) --You could put something here for when the timer ends. end ,10000, 1 --Timer runs for 1 minute, that's 60000 milliseconds. ) --End of timer script else --Checks for the opposit return of (if) events (AKA the account wasn't in the ACL group we checked for (SuperModerator). outputChatBox ( "You're not a smod, piss off!", player, 255, 12, 15 ) --If the account name's not in the ACL group we checked for, tell them to piss off! end end addCommandHandler ( "startcountdown", ShowCountdown ) --Attaches a command of your choice to the function above (ShowCountdown). REMEMBER, the (if) event above that checks accounts for ACL groups, can only be used server sided. Here's if you're using client sided: function ShowCountdown () --You could put something here for when the timer starts. setTimer ( function ( ) --You could put something here for when the timer ends. end ,60000, 1 --Timer runs for 1 minute, that's 60000 milliseconds. ) end addCommandHandler ( "startcountdown", ShowCountdown ) --Attaches a command of your choice to the function above (ShowCountdown). If you're not sure if your LUA file is server sided or client sided, go to the (meta.xml) file the folder of the LUA script, open it, and check if it says type="server" /> or type="client" /> Goodluck. Add me on Skype if you have any questions.[email protected] Edited July 3, 2017 by Justin|X5| Added how many milliseconds = 1 minute Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now