• Welcome to Vice City Multiplayer.
 

[Pawn]Timers

Started by Robd, February 03, 2011, 02:40:45 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Robd

Timer's have been giving me a lot of syntax errors, could someone please explain the criteria for a timer to work?
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

[GCK]KoFFe

 :-\ like what any idea? could u gave us any script idea

Well timer don't works on

public bla(playerid)
{
Bla bla bla
}

which include playerid or else
it should be cleared like ()

public Whatever()
{
Never Mind
}

SetTimer("Whatever",5000,false);

Whatever is Variable that Runs 

and 5000 is Time settings 5000 = 5secs
and false thing is loop the timer you can use True/False or 1/0

Robd

sometimes when i do a function like

stock test()
{
    SendClientMessageToAll(COLOR_GREEN,"blablabla");
    ServerInfo[0][variable] = 1;
}

SetTimer("test",10000,0");

it gives me syntax errors
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

aXXo

Quote from: Robd on February 03, 2011, 09:48:59 PM
sometimes when i do a function like

stock test()
{
    SendClientMessageToAll(COLOR_GREEN,"blablabla");
    ServerInfo[0][variable] = 1;
}

SetTimer("test",10000,0");  //<----- This line

it gives me syntax errors
Theres a syntax error in the line i specified.
It should be:
SetTimer("test",10000,false);

true means timer runs infinite times...
false means timer runs only one time.
Integers have no effect in the 3rd parameter, it runs infinite times if u put integers.....better use true/false

[GCK]KoFFe

use Public instead of stock


Quotestock test()
{
    SendClientMessageToAll(COLOR_GREEN,"blablabla");
    ServerInfo[0][variable] = 1;
}

SetTimer("test",10000,0");  //

To
Quote
public test()
{
    SendClientMessageToAll(COLOR_GREEN,"blablabla");
    ServerInfo[0][variable] = 1;
}

SetTimer("test",10000,0");  //

Robd

Thank you  :)

One more question, sometimes when using timers with variables like

public test(playerid);
{
    PlayerInfo[playerid][test] = 1;
}

I get the same errors, is there anything i can do to avoid that?
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

aXXo

You cannot pass parameters in functions when using timers.

It has to be:
public test()
{
...
return 1;
}

For using timers applicable only on certain variables you have to use SetTimerEx, which doesnt exists in VCMP.

[GCK]KoFFe

Quotewhich doesnt exists in VCMP.
XD ;D

Robd

hmmm, glad i figured out a solution for this...
if anyone's interested i have an idea that would include using ServerInfo before the timer and then reading that in the actual function for later use...
Hello, this is Robd from the past.
If you are seeing this I have either posted something stupid, forgotten something, started a stupid topic, or a combination of the three.

Please forgive us for this mistake.

Regards, management

heekz.shadow

aXXo...you made it with playerid...Why just dont help him with playerid at timers?


Pro Scripter[/b][/i][/u]