Author Topic: [Pawn]Timers  (Read 6441 times)

0 Members and 1 Guest are viewing this topic.

Offline Robd

  • Wiseguy
  • **
  • Posts: 67
    • View Profile
[Pawn]Timers
« on: February 03, 2011, 05:40:45 pm »
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

Offline [GCK]KoFFe

  • Street Thug
  • *
  • Posts: 27
    • View Profile
Re: [Pawn]Timers
« Reply #1 on: February 04, 2011, 12:44:46 am »
 :-\ 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

Offline Robd

  • Wiseguy
  • **
  • Posts: 67
    • View Profile
Re: [Pawn]Timers
« Reply #2 on: February 04, 2011, 12:48:59 am »
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

Offline aXXo

  • Wiseguy
  • **
  • Posts: 50
    • View Profile
Re: [Pawn]Timers
« Reply #3 on: February 04, 2011, 02:24:38 am »
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

Offline [GCK]KoFFe

  • Street Thug
  • *
  • Posts: 27
    • View Profile
Re: [Pawn]Timers
« Reply #4 on: February 04, 2011, 01:00:07 pm »
use Public instead of stock


Quote
stock 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");  //

Offline Robd

  • Wiseguy
  • **
  • Posts: 67
    • View Profile
Re: [Pawn]Timers
« Reply #5 on: February 05, 2011, 12:32:04 am »
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

Offline aXXo

  • Wiseguy
  • **
  • Posts: 50
    • View Profile
Re: [Pawn]Timers
« Reply #6 on: February 05, 2011, 04:35:55 am »
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.

Offline [GCK]KoFFe

  • Street Thug
  • *
  • Posts: 27
    • View Profile
Re: [Pawn]Timers
« Reply #7 on: February 05, 2011, 10:56:26 am »
Quote
which doesnt exists in VCMP.
XD ;D

Offline Robd

  • Wiseguy
  • **
  • Posts: 67
    • View Profile
Re: [Pawn]Timers
« Reply #8 on: February 05, 2011, 07:30:50 pm »
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

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: [Pawn]Timers
« Reply #9 on: February 10, 2011, 09:52:39 am »
aXXo...you made it with playerid...Why just dont help him with playerid at timers?
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players