Help with cp!
#1

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
Reply
#2

use OnPlayerLeaveCheckpoint then kill the timer
Reply
#3

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
Reply
#4

You have to store the timer ID in a variable.

pawn Код:
new captureTimer;

captureTimer = SetTimer(...);

KillTimer(captureTimer);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)