SA-MP Forums Archive
Help with cp! - 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: Help with cp! (/showthread.php?tid=315362)



Help with cp! - Setkus - 02.02.2012

Hello, guys!

pawn Код:
if(gTeam[playerid] == TEAM_BLUE || TEAM_GREEN) // Guessing the Blue team is defined as this
        {
        if(Checkpoint)
        {
        SendClientMessage(playerid,OBJECTIVE_COLOR,"Wait 20 seconds.");
        SetTimerEx("SetZone",20000,false,"i",playerid);
        }
        }
pawn Код:
forward SetZone(playerid);
public SetZone(playerid)
{
SendClientMessage(playerid, OBJECTIVE_COLOR, "You have captured the flag.");
return 1;
}
And all I need is how to do that if player is not in that Checkpoint so the timer should end? I hope you understand me, thanks for any help


Re: Help with cp! - Snowman12 - 02.02.2012

use OnPlayerLeaveCheckpoint then kill the timer


Re: Help with cp! - Setkus - 03.02.2012

I have a problem. When I put Kill timer under Leave OnPlayerLeaveCheckpoint i got error:

pawn Код:
D:\GTASA~1\USAVS~1.MEC\GAMEMO~1\dykuma.pwn(826) : error 076: syntax error in the expression, or invalid function call
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
and here is the code:

pawn Код:
public OnPlayerLeaveCheckpoint(playerid)
        {
        SendClientMessage(playerid,OBJECTIVE_COLOR,"You have left the zone.");
        KillTimer(SetZone);
        return 1;
        }
So could anyone help me? Thanks for any help


Re: Help with cp! - MP2 - 03.02.2012

You have to store the timer ID in a variable.

pawn Код:
new captureTimer;

captureTimer = SetTimer(...);

KillTimer(captureTimer);