Timer and delete timer

Started by umar4911, Jun 08, 2018, 08:09 PM

Previous topic - Next topic

umar4911

How to make timers in Client Side. NewTimer doesn't exist in Client Side.

How to delete a timer in both server side and client side.

Off-topic: Where did vitogta go?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter


umar4911

Suppose there is a timer
Timer.Create(this, abc, 1000, 0)How to identify this timer? How to see that it exists or not? How to destroy this timer?
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

vitogta

function Script::ScriptLoad()
{
 local hash = Timer.Create(this, function(text, int) {
  Console.Print(text + int);
 }, 1000, 0, "Timer Text ", 12345);

 Console.Print(hash);

 if(Timer.Exists(hash)){
 //...
 }

 Timer.Destroy(hash);
}

umar4911

Quote from: vitogta on Jun 08, 2018, 09:20 PMfunction Script::ScriptLoad()
{
 local hash = Timer.Create(this, function(text, int) {
  Console.Print(text + int);
 }, 1000, 0, "Timer Text ", 12345);

 Console.Print(hash);

 if(Timer.Exists(hash)){
 //...
 }

 Timer.Destroy(hash);
}
Means I need to record the hash of player and then delete it using the hash.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter

Xmair

Just store the timer inside a variable and delete it when you want to.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

[KM]Helathien

Bro the easiet way is just name the timer in onscriptload
Ex
T1=NewTimer..........


And then when u want to remove it just so
T1. Delete()
Feel free to PM me for any help.
If I am not available on the forum come to VKs Official Server I am usually there.

umar4911

Quote from: [KM]Helathien on Jun 22, 2018, 08:44 AMBro the easiet way is just name the timer in onscriptload
Ex
T1=NewTimer..........


And then when u want to remove it just so
T1. Delete()
Already solved man! Dont bump these topics.
RT Member | Asian City Scripter | CTB Contributor | VKs Contributor | European City Contributor | EAD Scripter