28.07.2016, 11:32
How to make something when you team lost zone like You team has lost Snake Farm you lost -2 score
This is when capture
But how make if team lost zone ?
This is when capture
Код:
stock ActiveSnakeFarm(playerid)
{
if(Spectating[playerid] == 0 || PlayerInfo[playerid][OnDuty] == 0)
{
if(UnderAttack[SNAKE] == 0)
{
if(!IsPlayerInAnyVehicle(playerid))
{
UnderAttack[SNAKE] = 1;
timer[playerid][SNAKE] = SetTimerEx("SnakeFarm", 25000, false,"i",playerid);
Captured[playerid][SNAKE] = 0;
SendClientMessage(playerid, 0xFFFFFFFF,"| - Stay in this checkpoint for 25 seconds to capture! - |");
if(gTeam[playerid] == TEAM_EURASIA)
{
GangZoneFlashForAll(Zone[SNAKE], TEAM_ZONE_EURASIA_COLOR);
}
else if(gTeam[playerid] == TEAM_ARAB)
{
GangZoneFlashForAll(Zone[SNAKE], TEAM_ZONE_ARAB_COLOR);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
GangZoneFlashForAll(Zone[SNAKE], TEAM_ZONE_SOVIET_COLOR);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneFlashForAll(Zone[SNAKE], TEAM_ZONE_USA_COLOR);
}
else if(gTeam[playerid] == TEAM_AUS)
{
GangZoneFlashForAll(Zone[SNAKE], TEAM_ZONE_AUS_COLOR);
}
//------Message-----
if(tCP[SNAKE] == TEAM_EURASIA)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<EURASIA>");
SendTeamMessage(TEAM_EURASIA, green,"*Snakes Farm is under attack!");
}
else if(tCP[SNAKE] == TEAM_ARAB)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<ARAB>");
SendTeamMessage(TEAM_ARAB, green,"*Snakes Farm is under attack!");
}
else if(tCP[SNAKE] == TEAM_SOVIET)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<SOVIET>");
SendTeamMessage(TEAM_SOVIET, green,"*Snakes Farm is under attack!");
}
else if(tCP[SNAKE] == TEAM_USA)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<USA>");
SendTeamMessage(TEAM_USA, green,"*Snakes Farm is under attack!");
}
else if(tCP[SNAKE] == TEAM_AUS)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is controlled by team "COL_RED"<AUSTRALIA>");
SendTeamMessage(TEAM_AUS, green,"*Snakes Farm is under attack!");
}
else if(tCP[SNAKE] == TEAM_NONE)
{
SendClientMessage(playerid, COLOR_WHITE,"This flag is not controlled by any team");
}
//---------loop-------//
for(new i = 0; i < MAX_PLAYERS; i ++)
{
IsPlayerCapturing[i][SNAKE] = 1;
}
}
else return CaptureZoneMessage(playerid, 1);
}
else return CaptureZoneMessage(playerid, 2);
}
else return CaptureZoneMessage(playerid, 3);
return 1;
}
stock SnakeFarmCaptured(playerid)
{
Captured[playerid][SNAKE] = 1;
UnderAttack[SNAKE] = 0;
KillTimer(timer[playerid][SNAKE]);
TextDrawHideForPlayer(playerid, CountText[playerid]);
CountVar[playerid][SNAKE] = 25;
GivePlayerScore(playerid, 5);
GivePlayerMoney(playerid, 5000);
SendClientMessage(playerid, COLOR_WHITE,"You got +5 scores and +$5000 cash for this area!");
//==========================================================================
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][SNAKE] = 0;
if(gTeam[i] == gTeam[playerid] && i != playerid && PlayerInfo[i][OnDuty] == 0)
{
SendClientMessage(i, 0xFFFFFFFF,"*Your team has captured "cred"Snakes farm"cwhite"! You received +1 score for it!");
GivePlayerScore(i, 1);
}
}
//==========================================================================
tCP[SNAKE] = gTeam[playerid];
GangZoneStopFlashForAll(Zone[SNAKE]);
//==========================================================================
if(gTeam[playerid] == TEAM_EURASIA)
{
GangZoneShowForAll(Zone[SNAKE], TEAM_ZONE_EURASIA_COLOR);
}
else if(gTeam[playerid] == TEAM_ARAB)
{
GangZoneShowForAll(Zone[SNAKE], TEAM_ZONE_ARAB_COLOR);
}
else if(gTeam[playerid] == TEAM_SOVIET)
{
GangZoneShowForAll(Zone[SNAKE], TEAM_ZONE_SOVIET_COLOR);
}
else if(gTeam[playerid] == TEAM_USA)
{
GangZoneShowForAll(Zone[SNAKE], TEAM_ZONE_USA_COLOR);
}
else if(gTeam[playerid] == TEAM_AUS)
{
GangZoneShowForAll(Zone[SNAKE], TEAM_ZONE_AUS_COLOR);
}
//==========================================================================
new str[128];
format(str, sizeof(str),"%s has captured Snakes Farm for team %s", pName(playerid), GetTeamName(playerid));
SendBoxMessage(str);
return 1;
}
stock LeavingSnakeFarm(playerid)
{
Captured[playerid][SNAKE] = 1;
UnderAttack[SNAKE] = 0;
KillTimer(timer[playerid][SNAKE]);
TextDrawHideForPlayer(playerid, CountText[playerid]);
CountVar[playerid][SNAKE] = 25;
GangZoneStopFlashForAll(Zone[SNAKE]);
for(new i = 0; i < MAX_PLAYERS; i++)
{
IsPlayerCapturing[i][SNAKE] = 0;
}
PlayAudioStreamForPlayer(playerid,"http://files.mboxdrive.com/100000856487902/WR_StoleFlag.wav");
SendClientMessage(playerid, red,"*You have been failed to capture this zone!");
return 1;
}
forward SnakeFarm(playerid);
public SnakeFarm(playerid)
{
SnakeFarmCaptured(playerid);
return 1;
}

