Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Snippet Showroom => Topic started by: Fuzzy168 on July 25, 2013, 11:19:12 am
-
What's new with this timing system?
Nothing...
How is this timer different from the SetTimer() function?
The only differences is it isn't hardcoded or made into a single function like SetTimer() does.
Can this timer help cover up the holes the SetTimer() function has left? The fact it doesn't have any arguments argument?
That's exactly what it does.
Is this new timer system efficient?
Doubtful, but I think it is accurate enough. I'll run some test and upload screenshots.
I want to try this. Where can I get it?
Over here.
[pawn]#include <time>[/pawn]
[pawn] new interval = 1000; /* Miliseconds */
new repeating = 5; /* Number of times to repeat */
new isDone = 0;
new initTime = tickcount();
new repeated = 0;
while( isDone == 0 )
{
new lastCheckedTime = tickcount();
if( lastCheckedTime - initTime >= interval )
{
initTime = tickcount();
//What you this timer to do when an interval has passed.
repeated++;
if( repeated == repeating )
{
isDone = 1;
}
}
}
return 1;[/pawn]
How do I use this in a function?
Take this sample code as an example.
[pawn]#include <a_vcmp>
#include <time>
forward TestFunction( const argument1[], const argument2[], const argument3[] );
main()
{
print( "TimerTest lock and loaded..." );
}
public OnGameModeInit()
{
TestFunction( "I'm 1st.", "Why am I always 2nd", "Not 3rd again.." );
return 1;
}
public TestFunction( const argument1[], const argument2[], const argument3[] )
{
new interval = 1000; /* Miliseconds */
new repeating = 5; /* Number of times to repeat */
new isDone = 0;
new initTime = tickcount();
new repeated = 0;
while( isDone == 0 )
{
new lastCheckedTime = tickcount();
if( lastCheckedTime - initTime >= interval )
{
initTime = tickcount();
//What you this timer to do when an interval has passed.
print( argument1 );
print( argument2 );
print( argument3 );
repeated++;
if( repeated == repeating )
{
isDone = 1;
}
}
}
return 1;
}[/pawn]
What would that code return?
This is what that code will return.
I'm 1st.
Why am I always 2nd
Not 3rd again..
I'm 1st.
Why am I always 2nd
Not 3rd again..
I'm 1st.
Why am I always 2nd
Not 3rd again..
I'm 1st.
Why am I always 2nd
Not 3rd again..
I'm 1st.
Why am I always 2nd
Not 3rd again..
Credits:Fuzzie(Me)
-
:o wtf is this... xD so many lines... i choose the old settimer xD but if you say if work "nice work"
-
:o wtf is this... xD so many lines... i choose the old settimer xD but if you say if work "nice work"
You are free to use the SetTimer() in the a_vcmp.inc. This system is for those who want to use timer with arguments. For example, a healing command/function.
-
Looks pretty decent to me. Gotta test it out with different things.
-
Looks pretty decent to me. Gotta test it out with different things.
Thanks.. I can't really test it with people because Pawn servers just don't show up in other's Internet List. :/
-
What the heck is this? This is just an overly complex way of passing variables thru timers, but this isn't even a timer this is a repeating loop.
-
What the heck is this? This is just an overly complex way of passing variables thru timers, but this isn't even a timer this is a repeating loop.
I think I've should have called it Timing system. I've tried making a single function but it doesn't work. Using this script once or twice wouldn't really burden much..
-
I think I've should have called it Timing system. I've tried making a single function but it doesn't work. Using this script once or twice wouldn't really burden much..
Not my point, the point is if you are going to release something for the public to use make it as simple as possible because not everyone is as good at something as you are.
-
I think I've should have called it Timing system. I've tried making a single function but it doesn't work. Using this script once or twice wouldn't really burden much..
Not my point, the point is if you are going to release something for the public to use make it as simple as possible because not everyone is as good at something as you are.
This is the simplest I could have done. :-\
-
I dunno how does it work, but it sounds goed as for me :)