Small Help in Capture Zone REP+
#1

Hello Fellows!
Friends i am suffering from big problem in my script that are two player at once a zone so is someone who can tell me how to stop it and enable capture for one person at once.

HERE IS THE CODE

Код:
stock ActiveSnakeFarm(playerid)
{
	if(Spectating[playerid] == 0 || PlayerInfo[playerid][OnDuty] == 0 || gTeam[playerid] != TEAM_MERC)
	{
		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, red,"[ZONE] "cwhite"Stay in the capture checkpoint for 25 seconds to capture this zone!");
             	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, C_DGREEN,"[ZONE] "cwhite"This zone is captured by team "lime"<EURASIA>");
			      SendTeamMessage(TEAM_EURASIA, C_DGREEN,"[ZONE] "cwhite"Snakes Farm is under attack!");
			    }
			    else if(tCP[SNAKE] == TEAM_ARAB)
			    {
			      SendClientMessage(playerid, C_DGREEN,"[ZONE] "cwhite"This zone is captured by team "lime"<ARAB>");
			      SendTeamMessage(TEAM_ARAB, C_DGREEN,"[ZONE] "cwhite"Snakes Farm is under attack!");
			    }
			    else if(tCP[SNAKE] == TEAM_SOVIET)
			    {
			      SendClientMessage(playerid, C_DGREEN,"[ZONE] "cwhite"This zone is captured by team "lime"<SOVIET>");
			      SendTeamMessage(TEAM_SOVIET, C_DGREEN,"[ZONE] "cwhite"Snakes Farm is under attack!");
				}
				else if(tCP[SNAKE] == TEAM_USA)
				{
				  SendClientMessage(playerid, C_DGREEN,"[ZONE] "cwhite"This zone is captured by team "lime"<USA>");
				  SendTeamMessage(TEAM_USA, C_DGREEN,"[ZONE] "cwhite"Snakes Farm is under attack!");
				}
				else if(tCP[SNAKE] == TEAM_AUS)
				{
			      SendClientMessage(playerid, C_DGREEN,"[ZONE] "cwhite"This zone is captured by team "lime"<AUSTRALIA>");
			      SendTeamMessage(TEAM_AUS, C_DGREEN,"[ZONE] "cwhite"Snakes Farm is under attack!");
				}
				else if(tCP[SNAKE] == TEAM_NONE)
				{
			      SendClientMessage(playerid, C_DGREEN,"[ZONE] "cwhite"This zone is not captured 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);
    TextDrawShowForPlayer(playerid, Rank1[playerid]);
	new str[200];
    SendClientMessage(playerid, C_DGREEN,"[ZONE] "cwhite"You have captured "lgreen"Snakes Farm "cwhite"for your team! "lgreen"+5 Score and +$5000.");

	//==========================================================================
	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, C_DGREEN,"[ZONE] "cwhite"Your team has captured "lime"Snakes Farm "cwhite"! You receive "lime"+1 "cwhite"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);
    }
    //==========================================================================
    format(str, sizeof(str),"~y~%s ~w~has captured ~b~Snakes Farm ~w~for team ~r~%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;
	}
    SendClientMessage(playerid, red,"[ZONE] "cwhite"You have been failed to capture this zone!");
    return 1;
}
forward SnakeFarm(playerid);
public SnakeFarm(playerid)
{
	SnakeFarmCaptured(playerid);
	return 1;
}
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	if(checkpointid == CP[SNAKE])
	{
		if(Spectating[playerid] == 0) {
			if(UnderAttack[SNAKE] == 0) {
				if(PlayerInfo[playerid][OnDuty] == 0) {
					if(tCP[SNAKE] != gTeam[playerid]) {
					    if(gTeam[playerid] != TEAM_MERC) {
							CountVar[playerid][SNAKE] = 25;
							ActiveSnakeFarm(playerid);
						} else return SendClientMessage(playerid, red,"*Mercenary team cannot capture zones");
					} else return SendClientMessage(playerid, -1,"*This zone is controlled by your team!");
				} else return CaptureZoneMessage(playerid, 3);
			} else return CaptureZoneMessage(playerid, 2);
		} else return 0;
	}
return 1;
}
This is the main part of capture zone

REP+ who help me to fix that problem
Reply
#2

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)