SA-MP Forums Archive
Just can't fix it, help please! - 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: Just can't fix it, help please! (/showthread.php?tid=294177)



Just can't fix it, help please! - Fmfan - 31.10.2011

I got 2 error when I compile my gamemode:

pawn Код:
C:\DOCUME~1\Fmfan\Desktop\Server\GAMEMO~1\tdm.pwn(780) : error 076: syntax error in the expression, or invalid function call
C:\DOCUME~1\Fmfan\Desktop\Server\GAMEMO~1\tdm.pwn(801) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


2 Errors.
Line 780
pawn Код:
KillTimer(BombBoom);
and 801
pawn Код:
KillTimer(BombBoom);



Re: Just can't fix it, help please! - Stigg - 31.10.2011

Where and how are you setting the timer ? Can we see the code ?


Re: Just can't fix it, help please! - Fmfan - 31.10.2011

when player enters checkpoint timer starts

pawn Код:
SetTimer("BombBoom",120000,0);
pawn Код:
public BombBoom()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(Planted == 1)
        {
            CreateExplosion(2005.4860,-131.8112,19.1708,10,10.0);
            CreateExplosion(2005.4860+4,-131.8112,19.1708,10,10.0);
            CreateExplosion(2005.4860-4,-131.8112,19.1708,10,10.0);
            CreateExplosion(2005.4860,-131.8112+4,19.1708,10,10.0);
            CreateExplosion(2005.4860,-131.8112-4,19.1708,10,10.0);
            CreateExplosion(2005.4860,-131.8112,19.1708+4,10,10.0);
            DestroyObject(Bomb);
            SendClientMessageToAll(COLOR_YELLOW,"BOMB: Rangers base has been destroyed! Terrorists have won this round!");
            SendClientMessageToAll(COLOR_RED,"HINT: New round starting in 10 seconds!");
            KillsTerroristTeam++;
            TogglePlayerControllable(i,0);
            SetTimer("SelectClass",10000,0);
        }
        if(Planted == 2)
        {
            CreateExplosion(1903.6765,-568.5011,32.6676,10,10.0);
            CreateExplosion(1903.6765+4,-568.5011,32.6676,10,10.0);
            CreateExplosion(1903.6765-4,-568.5011,32.6676,10,10.0);
            CreateExplosion(1903.6765,-568.5011+4,32.6676,10,10.0);
            CreateExplosion(1903.6765,-568.5011-4,32.6676,10,10.0);
            CreateExplosion(1903.6765,-568.5011,32.6676+4,10,10.0);
            DestroyObject(Bomb);
            SendClientMessageToAll(COLOR_YELLOW,"BOMB: Terrorist base has been destroyed! Rangers have won this round!");
            SendClientMessageToAll(COLOR_RED,"HINT: New round starting in 10 seconds!");
            KillsRangerTeam++;
            TogglePlayerControllable(i,0);
            SetTimer("SelectClass",10000,0);
        }
    }
    return 1;
}



Re: Just can't fix it, help please! - Restorer - 31.10.2011

KillTimer(ID);


ID
= ID returned by SetTimer or SetTimerEx.


Pozdrawiam!.



Replace the loops on foreach , will be faster.


Re: Just can't fix it, help please! - Kostas' - 31.10.2011

To kill a timer is like this
pawn Код:
new
      SCTimer;

SCTimer = SetTimer("SelectClass",10000,0);
KillTimer(SCTimer);



Re: Just can't fix it, help please! - Stigg - 31.10.2011

Quote:
Originally Posted by Fmfan
Посмотреть сообщение
when player enters checkpoint timer starts

pawn Код:
public BombBoom()
{
    for(new i = 0; i < GetMaxPlayers(); i++)
    {
        if(Planted == 1)
        {
            CreateExplosion(2005.4860,-131.8112,19.1708,10,10.0);
            CreateExplosion(2005.4860+4,-131.8112,19.1708,10,10.0);
            CreateExplosion(2005.4860-4,-131.8112,19.1708,10,10.0);
            CreateExplosion(2005.4860,-131.8112+4,19.1708,10,10.0);
            CreateExplosion(2005.4860,-131.8112-4,19.1708,10,10.0);
            CreateExplosion(2005.4860,-131.8112,19.1708+4,10,10.0);
            DestroyObject(Bomb);
            SendClientMessageToAll(COLOR_YELLOW,"BOMB: Rangers base has been destroyed! Terrorists have won this round!");
            SendClientMessageToAll(COLOR_RED,"HINT: New round starting in 10 seconds!");
            KillsTerroristTeam++;
            TogglePlayerControllable(i,0);
            SetTimer("SelectClass",10000,0);
        }
        if(Planted == 2)
        {
            CreateExplosion(1903.6765,-568.5011,32.6676,10,10.0);
            CreateExplosion(1903.6765+4,-568.5011,32.6676,10,10.0);
            CreateExplosion(1903.6765-4,-568.5011,32.6676,10,10.0);
            CreateExplosion(1903.6765,-568.5011+4,32.6676,10,10.0);
            CreateExplosion(1903.6765,-568.5011-4,32.6676,10,10.0);
            CreateExplosion(1903.6765,-568.5011,32.6676+4,10,10.0);
            DestroyObject(Bomb);
            SendClientMessageToAll(COLOR_YELLOW,"BOMB: Terrorist base has been destroyed! Rangers have won this round!");
            SendClientMessageToAll(COLOR_RED,"HINT: New round starting in 10 seconds!");
            KillsRangerTeam++;
            TogglePlayerControllable(i,0);
            SetTimer("SelectClass",10000,0);
        }
    }
    return 1;
}
https://sampwiki.blast.hk/wiki/KillTimer

Read this link, look on how the timer is set up and then killed.


Re: Just can't fix it, help please! - Fmfan - 31.10.2011

Thanks, now it works


Re: Just can't fix it, help please! - Restorer - 31.10.2011

I explained him ....