13.10.2013, 12:47
You loop through the zones and it actually capture all the zones.
Pass the zone's ID by either as parameter or by storing it in a variable and check inside the loop if the i is equal to that zoneid. If they do match, then continue with the rest of the code inside of it.
EDIT:
Be patient.. I cannot reply in the first minute and don't double post, there's an Edit button.
Pass the zone's ID by either as parameter or by storing it in a variable and check inside the loop if the i is equal to that zoneid. If they do match, then continue with the rest of the code inside of it.
pawn Код:
stock CAPZONECaptured(playerid)
{
for(new i=0; i < sizeof(CZoneInfo); i++)
{
Captured[playerid][CZoneInfo[i][CName]] = 1;
UnderAttack[CZoneInfo[i][CName]] = 0;
KillTimer(timer[playerid][CZoneInfo[i][CName]]);
CountVar[playerid][CZoneInfo[i][CName]] = 25;
GivePlayerScore(playerid, 5);
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, COLOR_GREEN,"Congratulations! You have captured the area! You received +5 scores and +$5000 cash!");
//==========================================================================
for(new n = 0; n < MAX_PLAYERS; n++)
{
IsPlayerCapturing[n][i] = 0;
if(gTeam[n] == gTeam[playerid])
{
SendClientMessage(n, 0xFFFFFFFF,"*Your team has captured the area! You received +1 score for it!");
GivePlayerScore(n, 1);
}
}
//==========================================================================
tCP[CZoneInfo[i][CName]] = gTeam[playerid];
GangZoneStopFlashForAll(CZoneInfo[i][CName]);
//==========================================================================
if(gTeam[playerid] == TEAM_U)
{
GangZoneShowForAll(Zone[CZoneInfo[i][CName]], TEAM_U_COLOR);
}
else if(gTeam[playerid] == TEAM_R)
{
GangZoneShowForAll(Zone[CZoneInfo[i][CName]], TEAM_R_COLOR);
}
else if(gTeam[playerid] == TEAM_A)
{
GangZoneShowForAll(Zone[CZoneInfo[i][CName]], TEAM_A_COLOR);
}
else if(gTeam[playerid] == TEAM_A1)
{
GangZoneShowForAll(Zone[CZoneInfo[i][CName]], TEAM_A1_COLOR);
}
else if(gTeam[playerid] == TEAM_E)
{
GangZoneShowForAll(Zone[CZoneInfo[i][CName]], TEAM_E_COLOR);
}
//==========================================================================
//==========================================================================
new str[128];
format(str, sizeof(str),"%s has captured the capture zone!", GetName(playerid));
SendClientMessageToAll(COLOR_ORANGE, str);
}
return 1;
}
Be patient.. I cannot reply in the first minute and don't double post, there's an Edit button.