SA-MP Forums Archive
Capture zones with multiple players - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Capture zones with multiple players (/showthread.php?tid=476780)



Capture zones with multiple players - NighelN - 20.11.2013

Hello,

How do i make it so when 2 or more players enter a capture zone it captures it for both so they both get money/score

My OnPlayerEnterDynamicCP:
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
	if(checkpointid == CP[OliFactory]) {
		if(tCP[OliFactory] == gTeam[playerid]) {
			if(gTeam[playerid] == TEAM_GERMANY && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_GERMANY);
			} else if(gTeam[playerid] == TEAM_IRAQ && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_IRAQ);
			} else if(gTeam[playerid] == TEAM_ENGLAND && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_ENGLAND);
			} else if(gTeam[playerid] == TEAM_USA && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_USA);
			} else if(gTeam[playerid] == TEAM_NETHERLANDS && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_NL);
			}
			return SendClientMessage(playerid, COLOR_RED,"This zone is already captured by your team");
		}
		if(UnderAttack[OliFactory] == 1) {
			if(gTeam[playerid] == TEAM_GERMANY && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_GERMANY);
			} else if(gTeam[playerid] == TEAM_IRAQ && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_IRAQ);
			} else if(gTeam[playerid] == TEAM_ENGLAND && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_ENGLAND);
			} else if(gTeam[playerid] == TEAM_USA && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_USA);
			} else if(gTeam[playerid] == TEAM_NETHERLANDS && CP[OliFactory]) {
				GangZoneShowForAll(Zone[OliFactory], COLOR_NL);
			}
			return SendClientMessage(playerid, COLOR_RED,"This zone is already being taken over!");
		}
		UnderAttack[OliFactory] = 1;
		GangZoneFlashForAll(Zone[OliFactory], gTeam[playerid]);
		if(gTeam[playerid] == TEAM_GERMANY && CP[OliFactory]) {
			GangZoneFlashForAll(Zone[OliFactory], COLOR_GERMANY);
		} else if(gTeam[playerid] == TEAM_IRAQ && CP[OliFactory]) {
			GangZoneFlashForAll(Zone[OliFactory], COLOR_IRAQ);
		} else if(gTeam[playerid] == TEAM_ENGLAND && CP[OliFactory]) {
			GangZoneFlashForAll(Zone[OliFactory], COLOR_ENGLAND);
		} else if(gTeam[playerid] == TEAM_USA && CP[OliFactory]) {
			GangZoneFlashForAll(Zone[OliFactory], COLOR_USA);
		} else if(gTeam[playerid] == TEAM_NETHERLANDS && CP[OliFactory]) {
			GangZoneFlashForAll(Zone[OliFactory], COLOR_NL);
		}
		timer[playerid][OliFactory] = SetTimerEx("SetZone",30000, false, "i", playerid);
		SendClientMessage(playerid, yellow,"You're Capturing this zone! Wait here for 30 Seconds!");
		new string[128];
		format(string, sizeof(string),"[ATTENTION]: OliFactory is being taken over!");
		SendClientMessageToAll(blue,string);
 		iCP[playerid] = OliFactory;
   }
   return 1;
}



Re: Capture zones with multiple players - NighelN - 22.11.2013

bump