[Include] Counters
#1

__________________________________________________ __________________________________________________

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:
  • None so far.
Reply
#2

Nice to see it uses y_iterate. Good job Crayder!
Reply
#3

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.
Reply
#4

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.
Reply
#5

Good Job xD
Reply
#6

Very nice
Reply
#7

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.
Reply
#8

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.
Reply
#9

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!
Reply
#10

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.
Reply
#11

Its great! Keep it up.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)