[Include] Counters - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (
https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (
https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Counters (
/showthread.php?tid=586988)
Counters -
Crayder - 27.08.2015
__________________________________________________ __________________________________________________
Download here!
__________________________________________________ __________________________________________________
Description:
In the past, I was tired of seeing people over use timers for small tasks. I made this short library (well, a super simple version of it, see github initial commit) and forgot about it. Then I seen UltraScripter's US_Timers library. His is OK, but it is a good example of over-used timers. I told him about my old library and he said he'd like to see it. So that's when I dug it up. I told him I'd like to release it but it's not a competition and he said he didn't care, now I'm here. There is an example script on the git on how to use it but it's pretty simple.
Requirements:
YSI 3 or 4 (preferably 4).
__________________________________________________ __________________________________________________
Current Functions:
pawn Код:
StartPlayerCounter(playerid, pc_CounterMode:countermode = COUNTER_MODE_SECONDS)
//Start counting. Modes - COUNTER_MODE_SECONDS, COUNTER_MODE_MINUTES.
StopPlayerCounter(playerid, counterid)
//Stop counting, not needed but should be used when resetting counters.
GetPlayerCounterTime(playerid, counterid)
//Return time since the counter started (unit depends on mode).
IsValidPlayerCounter(playerid, counterid)
//Validate a counter.
// Global functions. All of these are the same as the player functions but globally.
StartCounter(pc_CounterMode:countermode = COUNTER_MODE_SECONDS)
StopCounter(counterid)
GetCounterTime(counterid)
IsValidCounter(counterid)
ConvertSeconds(unix, &secs, &mins, &hours)
//Just an extra function to convert seconds to seconds, minutes, and hours.
__________________________________________________ __________________________________________________
Known Issues:
Re: Counters -
ThePhenix - 27.08.2015
Nice to see it uses y_iterate. Good job Crayder!
Re: Counters -
Crayder - 27.08.2015
Quote:
Originally Posted by ThePhenix
Nice to see it uses y_iterate. Good job Crayder!
|
I might start releasing a bunch of my side projects. I've got quite the collection, as you may or may not know, I seem to forget all of the things we talk about... XD
And yea I also forgot to mention the dependencies.
Re: Counters -
ThePhenix - 27.08.2015
Quote:
Originally Posted by Crayder
I might start releasing a bunch of my side projects. I've got quite the collection, as you may or may not know, I seem to forget all of the things we talk about... XD
And yea I also forgot to mention the dependencies.
|
Yeah, I've noticed you always forget. Try to get some rest buddy, eh.
Re: Counters -
Dayvison_ - 27.08.2015
Good Job xD
Re: Counters -
ExTaZZ69 - 27.08.2015
Very nice
Re: Counters -
Yashas - 27.08.2015
In my opinion, using this include would make the server inefficient.
Once can do the exact same thing with just few variables and a common variable to keep track of seconds.And this would be at least 50x faster than this include.
Re : Re: Counters -
AlexBlack - 27.08.2015
Quote:
Originally Posted by Yashas
In my opinion, using this include would make the server inefficient.
Once can do the exact same thing with just few variables and a common variable to keep track of seconds.And this would be at least 50x faster than this include.
|
I agree,
Anyway nice job.
Re: Counters -
PT - 27.08.2015
Quote:
Originally Posted by Crayder
I might start releasing a bunch of my side projects. I've got quite the collection, as you may or may not know, I seem to forget all of the things we talk about... XD
And yea I also forgot to mention the dependencies.
|
I hope you release yours jobs
Keep the good work!
Re: Counters -
Crayder - 27.08.2015
Quote:
Originally Posted by Yashas
In my opinion, using this include would make the server inefficient.
Once can do the exact same thing with just few variables and a common variable to keep track of seconds.And this would be at least 50x faster than this include.
|
We all know your are the speed guru around here, and I'd like to see your tests no matter how bad they make this look. I'm just interested.
Re: Counters -
Evocator - 27.08.2015
Its great! Keep it up.