SA-MP Forums Archive
Turfs help - 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: Turfs help (/showthread.php?tid=455937)



Turfs help - yaron0600 - 03.08.2013

How to make it will be captured on the map ? Like to make the green color on the radar like this is Grove Street ... ?

Here's the command...

Код:
CMD:claim(playerid, params[])
{
	new string[128];
	new tw = GetPlayerTurfWarsZone(playerid);
	new family = PlayerInfo[playerid][pFMember];
	new rank = PlayerInfo[playerid][pRank];
	if(family == 255) {
		SendClientMessageEx(playerid, COLOR_GRAD2, "You are not in a family/gang, you can not claim turfs!");
		return 1;
	}
	if(rank < 5) {
		SendClientMessageEx(playerid, COLOR_GRAD2, "You have to be at least Rank 5 to claim turfs!");
		return 1;
	}
	if(FamilyInfo[family][FamilyTurfTokens] < 12) {
		SendClientMessageEx(playerid, COLOR_GRAD2, "Your family/gang does not have any turf claim tokens, please wait at least 12 hours.");
		return 1;
	}
	if(tw != -1) {
		if(TurfWars[tw][twLocked] == 1) {
			SendClientMessageEx(playerid, COLOR_GRAD2, "The turf is currently locked by a admin, you can not claim it!");
			return 1;
		}
		if(TurfWars[tw][twVulnerable] == 0) {
			if(TurfWars[tw][twActive] == 0) {
				if(TurfWars[tw][twOwnerId] == family) {
					SendClientMessageEx(playerid, COLOR_GRAD2, "Your family/gang already owns this turf, you are unable to claim it!");
					return 1;
				}
				new count = 0;
				foreach(Player, i) {
					if(family == PlayerInfo[i][pFMember]) {
						if(GetPlayerTurfWarsZone(i) == tw) {
							count++;
						}
					}
				}

				if(count > 2) {
					FamilyInfo[family][FamilyTurfTokens] -= 12;
					TakeoverTurfWarsZone(family, tw);
				}
				else {
					SendClientMessageEx(playerid, COLOR_GRAD2, "You need at least 3 of your family/gang members on the turf, to be able to claim it!");
				}
			}
			else {
				new count = 0;
				new leocount = 0;
				if(TurfWars[tw][twAttemptId] == family) {
					SendClientMessageEx(playerid, COLOR_GRAD2, "You are already attempting to capture this turf!");
					return 1;
				}

				foreach(Player, i) {
					if(TurfWars[tw][twAttemptId] == PlayerInfo[i][pFMember]) {
						if(GetPlayerTurfWarsZone(i) == tw) {
							count++;
						}
					}
					if(TurfWars[tw][twAttemptId] == -1) {
						if(IsACop(i)) {
							if(GetPlayerTurfWarsZone(i) == tw) {
								leocount++;
							}
						}
					}
				}

				if(count == 0 && leocount == 0) {
					if(family != TurfWars[tw][twOwnerId]) {
						FamilyInfo[family][FamilyTurfTokens] -= 12;
					}
					foreach(Player, i) {
						if(PlayerInfo[i][pGangModerator] == 1) {
							format(string,sizeof(string),"%s has attempted to takeover turf %d for family %s",GetPlayerNameEx(playerid),tw,FamilyInfo[family][FamilyName]);
							SendClientMessageEx(i,COLOR_YELLOW,string);
						}
					}
					TakeoverTurfWarsZone(family, tw);
				}
				else {
					if(leocount == 0) {
						format(string,sizeof(string),"There is still %d Attacking Members on the Turf, you must get rid of them before reclaiming!",count);
						SendClientMessageEx(playerid, COLOR_GRAD2, string);
					}
					else {
						format(string,sizeof(string),"There is still %d Officers on the Turf, you must get rid of them before reclaiming!",leocount);
						SendClientMessageEx(playerid, COLOR_GRAD2, string);
					}
				}
			}
		}
		else {
			SendClientMessageEx(playerid, COLOR_GRAD2, "This turf is currently not vulnerable, you are unable to claim it!");
		}
	}
	else {
		SendClientMessageEx(playerid, COLOR_GRAD2, "You have to be in a turf to be able to claim turfs!");
	}

	if(turfWarsRadar[playerid] == 0) {
		ShowTurfWarsRadar(playerid);
	}
	return 1;
}