Okay, I have created zones capturing system, but it works only with one team, so I tried to make it for two teams, but it's not working. Here is code.
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(checkpointid == CPS2){
if(gTeam[playerid] == TEAM_USA && CapturedBy == 1 || gTeam[playerid] == TEAM_GERMANY && CapturedBy == 2){
SendClientMessage(playerid, COLOR_RED, "This area has already been captured by your team!");
}
else
{
SendClientMessageToAll(0xFF80FFFF, "The gangzone is being taken over"); // Sending Message to all players.
ZoneTimer[1] = SetTimerEx("SetZone", 30000, false, "i", playerid); // Setting the Timer... ( 30 seconds )
}
}
}
public OnPlayerLeaveDynamicCP(playerid, checkpointid)
{
if(checkpointid == CPS2 && CapturedBy < 0){
SendClientMessage(playerid, 0x00FF007A, " You have left the checkpoint , You have failed to capture");
SendClientMessageToAll(0x00FF007A, "Zone was not taken over");
KillTimer(ZoneTimer[1]);
}
}
forward SetZone(playerid);
public SetZone(playerid)
{
if(IsPlayerInDynamicCP(playerid, CPS2)){
dini_IntSet("/zones/zones.ini", "CapturedBy", 1);
CapturedBy = 1;
SendClientMessage(playerid, COLOR_BLUE,"Installed");
}