SA-MP Forums Archive
Timer doesn't work?? - 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: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer doesn't work?? (/showthread.php?tid=396322)



Timer doesn't work?? - Louris - 30.11.2012

Код:
public OnGameModeInit()
{
SetTimer("pViplaikas",60000,true);
My enum:

Код:
INI_Int("VipoLaikas",PlayerInfo[playerid][pViplaikas]);
Код:
public OnPlayerSpawn(playerid)
{
if(PlayerInfo[playerid][pVip])
PlayerInfo[playerid][pViplaikas] --;
When i spawn, i get -1 minute, but only when i spawn, when i just playing, time doesn't decreasing..


Re: Timer doesn't work?? - [D]ry[D]esert - 30.11.2012

Hmmm. SetTimer("pViplaikas",60000,true);
Show us your pViplaikas public ?


Re: Timer doesn't work?? - Louris - 30.11.2012

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
Hmmm. SetTimer("pViplaikas",60000,true);
Show us your pViplaikas public ?
You mean this?
Код:
forward pViplaikas(playerid);
public pViplaikas(playerid);
If i write this code, i get errors:

C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 52) : error 021: symbol already defined: "pViplaikas"
C:\Users\Lauryno\Desktop\Servas\gamemodes\bom.pwn( 53) : error 021: symbol already defined: "pViplaikas"


Re: Timer doesn't work?? - Konstantinos - 30.11.2012

Use different name on the enum and on the timer.
You need to have the forward/public only one time on your script. According to the errors, these symbols already defined.


Re: Timer doesn't work?? - [D]ry[D]esert - 30.11.2012

pawn Код:
SetTimer("You Shall put CALLBACK name Not a Variable.",time,false or true);



Re: Timer doesn't work?? - Louris - 30.11.2012

I renamed timer to SetTimer("Viplaikas",60000,true); but the same shit..


Re: Timer doesn't work?? - Konstantinos - 30.11.2012

Did you only renamethe name from the timer? Did you also rename the forward/public name?


Re: Timer doesn't work?? - [D]ry[D]esert - 30.11.2012

As i guess this what you mean..
pawn Код:
public OnPlayerConnect(playerid)
{
SetTimerEx("pViplaikasAdd",60000,true,"i",playerid);
rest of your code..
}
forward pViplaikasAdd(playerid);
public pViplaikasAdd(playerid)
    {
    if(PlayerInfo[playerid][pVip])
        {
        PlayerInfo[playerid][pViplaikas] --;
        }
              }



Re: Timer doesn't work?? - Louris - 30.11.2012

Quote:
Originally Posted by [D]ry[D]esert
Посмотреть сообщение
As i guess this what you mean..
pawn Код:
public OnPlayerConnect(playerid)
{
SetTimerEx("pViplaikasAdd",60000,true,"i",playerid);
rest of your code..
}
forward pViplaikasAdd(playerid);
public pViplaikasAdd(playerid)
    {
    if(PlayerInfo[playerid][pVip])
        {
        PlayerInfo[playerid][pViplaikas] --;
        }
              }
Mhm, i using your code, but pViplaikas isn't decreasing.. When i disconnect from server, i get -1 pViplaikas.


Re: Timer doesn't work?? - Louris - 30.11.2012

Any ideas?