26.12.2012, 09:18
Use a variable
Put this at the top of your script (under the includes)
Now that variable will assign the zone to the team who captures it, it will be detection him by gTeam
P.S:
If the code doesn't work, contact me.
Put this at the top of your script (under the includes)
pawn Код:
new Zone[Max_Players];
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
if(Zone[playerid] == gTeam[playerid]) return SendClientMessage(playerid, 0x00FF007A, "This zone is already yours.");
SendClientMessage(playerid, 0x00FF007A, "Wait 30 Seconds - To Caputre this Zone.");
new namestr[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(namestr, sizeof(namestr), "[INFO]: %s[%d] Is trying to capture the checkpoint, Face him!", name, playerid);
SendClientMessageToAll(0xFF80FFFF, namestr);
timer = SetTimerEx("SetZone", 30000, false, "i", playerid);
Checkpoint[playerid] = 1; //
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
if(Checkpoint[playerid] == 1)
{
SendClientMessage(playerid, 0x00FF007A, " You have left the checkpoint , You have failed to capture");
new namestr[128], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(namestr, sizeof(namestr), "[INFO]: %s[%d] Failed to capture the checkpoint.", name, playerid);
SendClientMessageToAll(red, namestr);
KillTimer(timer);
Checkpoint[playerid] = 0;
}
return 1;
}
forward SetZone(playerid);
public SetZone(playerid)
{
SetPlayerScore(playerid,GetPlayerScore(playerid)+30 );
GivePlayerMoney(playerid,30000);
SendClientMessage(playerid, COLOR_BLUE,"You've captured the zone you received 30000 $ and 30 score");
if(gTeam[playerid] == TEAM_HOMO)
{
SendClientMessageToAll (red, "Team Homo has captured the CheckPoint");
}
if(gTeam[playerid] == TEAM_NIGGA)
{
SendClientMessageToAll (red, "Team Nigga has captured the CheckPoint");
}
Zone[playerid] = gTeam[playerid];
return 1;
}
If the code doesn't work, contact me.