![]() |
Countdown Script (Timer)
Well, Ive been having a hard time learning to Script.. but I just wanted a heads up on what to do on a Script for a timer on a jailer.. Like I want the player to see the timer ass in like 00:00:00 , like a countdown. Anyone help me?;)
|
You're going to need to use a timeout, or something similar. Since seconds are your smallest unit, make the 'jail time' count in seconds; e.g., 1 hour in jail would be 3600 seconds. Store that somewhere, like a clientr. variable.
Then, format those seconds into the hh:mm:ss format. There are functions in the Code Gallery for that, I think. But it's pretty easy math: hours = jailTimeinSeconds / 3600After that, you're going to need to do some special formatting to put zeros in front of single-digit numbers. (As simple as checking if the number < 10.) Then just display that however you want. |
Quote:
|
NPC Code:function onActionServerSide() This is the Script i'm trying to make a command that can work by hours minutes and seconds, like 00:00:00. I also Wanna make it stop counting down when I say :end, Help plz?:cool: |
I've added a token for setting how long you want the timer to go off from. Instead of just using the Auto one by press 1.
NPC Code:function onActionServerSide() |
Please use the PHP code tags, rather than the NPC code ones.
Your script doesn't have any kind of countdown mechanism. Here's some pseudo-code, just that I'm not doing everything for you. PHP Code:
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 12:49 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.