How can i make police can join a turf?
#1

Hello ladies and gentlemen!

I want to know how can i make LEO/POLICE can /shutdown the turf, Its the same on /capture, but /capture is for family. I want to make it so police can join the turf war.

Код:
CMD:capture(playerid, params[])
{
	new string[128];

	new mypoint = -1;
	if(GetPVarInt(playerid,"Injured") == 1)
	{
		SendClientMessage(playerid, COLOR_GRAD1, " You can't capture while injured!");
		return 1;
	}
	if(PlayerInfo[playerid][pGang] == 255 || PlayerInfo[playerid][pRank] < 5)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not high rank enough to capture!");
		return 1;
	}
	for (new i=0; i<MAX_POINTS; i++)
	{
		if(IsPlayerInRangeOfPoint(playerid, 1.0, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz])) mypoint = i;
	}
	if(mypoint == -1)
	{
		SendClientMessage(playerid, COLOR_GRAD1, "You're not at the capture place!");
		return 1;
	}
	if(Points[mypoint][Vulnerable] > 0 || Points[mypoint][Vulnerable] == -1)
	{
		SendClientMessage(playerid, COLOR_GRAD1, " This point is not ready for takeover.");
		return 1;
	}
	if(Points[mypoint][TimeToClaim])
	{
		SendClientMessage(playerid, COLOR_GRAD1, " This point is already being captured!");
		return 1;
	}
	/*if(GetPlayerPing(playerid) > pointpinglimit)
	{
		format(string,sizeof(string), " You can't capture with %d+ ping!", pointpinglimit);
		SendClientMessage(playerid, COLOR_WHITE, string);
		return 1;
	}*/
	Points[mypoint][PointBarID] = CreateProgressBar(258.00, 137.00, 131.50, 3.19, COLOR_GREEN, 100.0);
	SetProgressBarValue(Points[mypoint][PointBarID], 100.0);
	ShowProgressBarForPlayer(playerid, Points[mypoint][PointBarID]);
	format(string,sizeof(string), " %s is attempting to capture the point.", GetPlayerNameEx(playerid));
	ProxDetector(70.0, playerid, string, COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED,COLOR_RED);
	GetPlayerPos(playerid, Points[mypoint][Capturex], Points[mypoint][Capturey], Points[mypoint][Capturez]);

	Points[mypoint][ClaimerId] = playerid;
	Points[mypoint][TimeToClaim] = 1;
	Points[mypoint][TimeLeft] = 10;
	SetTimerEx("ProgressTimer", 1000, 0, "d", mypoint);
	return 1;
}
Код:
forward CaptureTimer(point);
public CaptureTimer(point)
{
	new string[128];
	new fam;
	if(Points[point][ClaimerId] != INVALID_PLAYER_ID && Points[point][TimeToClaim])
	{
		new claimer = Points[point][ClaimerId];
		new Float: x, Float: y, Float: z;
		GetPlayerPos(claimer, x, y, z);
		if(Points[point][Capturex] != x || Points[point][Capturey] != y || Points[point][Capturez] != z || GetPVarInt(Points[point][ClaimerId],"Injured") == 1)
		{
			SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. You either moved or died while attempting to capture.");
			Points[point][ClaimerId] = INVALID_PLAYER_ID;
			Points[point][TimeToClaim] = 0;
		}
		else
		{
			if(Points[point][Vulnerable] > 0)
			{
			    SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. The point was already captured.");
				Points[point][ClaimerId] = INVALID_PLAYER_ID;
				Points[point][TimeToClaim] = 0;
				return 1;
			}
			if(playerTabbed[claimer] != 0)
			{
			    SendClientMessage(Points[point][ClaimerId], COLOR_LIGHTBLUE, "You failed to capture. You were alt-tabbed.");
			    format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s (ID %d) may have possibly alt tabbed to capture a point.", GetPlayerNameEx(claimer), claimer);
				ABroadCast(COLOR_YELLOW, string, 1);

				format(string, sizeof(string), "%s may have possibly alt tabbed to capture a point.", GetPlayerNameEx(claimer));
				AddAutomatedFlag(claimer, string);

   				Points[point][ClaimerId] = INVALID_PLAYER_ID;
				Points[point][TimeToClaim] = 0;
			    return 1;
			}
			else
			{
				fam = PlayerInfo[claimer][pGang];
	            Points[point][PlayerNameCapping] = GetPlayerNameEx(claimer);
			   	format(string, sizeof(string), "%s is attempting to take over of the %s for %s, they'll own it in %d minutes.", Points[point][PlayerNameCapping], Points[point][Name], FamilyInfo[fam][FamilyName], TIME_TO_TAKEOVER);
				SendClientMessageToAllEx(COLOR_YELLOW, string);
				if(Points[point][CaptureProccessEx] >= 1)
				{
					Points[point][CaptureProccessEx] = 2;
				}
				Points[point][TakeOverTimerStarted] = 1;
				Points[point][TakeOverTimer] = 10;
				Points[point][ClaimerId] = INVALID_PLAYER_ID;
				Points[point][ClaimerTeam] = fam;
				Points[point][TimeToClaim] = 0;
				if(Points[point][CaptureTimerEx2] != -1) KillTimer(Points[point][CaptureTimerEx2]);
				Points[point][CaptureTimerEx2] = SetTimerEx("CaptureTimerEx", 60000, 1, "d", point);
			}
		}
	}
	return 1;
}
Код:
forward CaptureTimerEx(point);
public CaptureTimerEx(point)
{
	new string[128];
	new fam;
	if(Points[point][TakeOverTimerStarted])
	{
		fam = Points[point][ClaimerTeam];
		if(Points[point][TakeOverTimer] > 0)
		{
			Points[point][TakeOverTimer]--;
			//format(string, sizeof(string), "%s has successfully attempted to take over of %s for %s, it will be theirs in %d minutes!",
			//Points[point][PlayerNameCapping], Points[point][Name], FamilyInfo[fam][FamilyName], Points[point][TakeOverTimer]);
			//UpdateDynamic3DTextLabelText(Points[point][CaptureProccess], COLOR_YELLOW, string);
		}
		else
		{
			Points[point][ClaimerTeam] = INVALID_PLAYER_ID;
			for(new i = 0; i < MAX_PLAYERS; i++)
			{
			   if(PlayerInfo[i][pGang] == Points[point][ClaimerTeam])
			   {
			       PlayerInfo[i][pTokens] = PlayerInfo[i][pTokens] + 1;
			   }
			}
			Points[point][TakeOverTimer] = 0;
			Points[point][TakeOverTimerStarted] = 0;
			Points[point][Announced] = 0;
			Points[point][Vulnerable] = NEW_VULNERABLE;
			//DestroyDynamic3DTextLabel(Points[point][CaptureProccess]);
			Points[point][CaptureProccessEx] = 0;
			strmid(Points[point][Owner], FamilyInfo[fam][FamilyName], 0, 32, 32);
			strmid(Points[point][CapperName], Points[point][PlayerNameCapping], 0, 32, 32);
   			format(string, sizeof(string), "%s has taken control the %s for %s.", Points[point][CapperName], Points[point][Name], Points[point][Owner]);
			SendClientMessageToAllEx(COLOR_YELLOW, string);
			SendClientMessageToAllEx(COLOR_REALRED, "All of them will get +1 Tokens!");
			UpdatePoints();
			KillTimer(Points[point][CaptureTimerEx2]);
			Points[point][CaptureTimerEx2] = -1;
		}
	}
}
Код:
CMD:pointinfo(playerid, params[])
{
	new
		iCount,
		szMessage[128];

	SendClientMessage(playerid, COLOR_NEWS, "Point Info:");
	for(new i; i < MAX_POINTS; i++) {
		if(Points[i][Type] >= 0) {
		    if(Points[i][Vulnerable] == 0 && Points[i][TakeOverTimerStarted] > 0)
			{
				if(Points[i][TakeOverTimer] == 0)
				{
					format(szMessage, sizeof(szMessage), "* %s | Capper: %s | Family: %s | Time left: Less than 1 minute", Points[i][Name], Points[i][PlayerNameCapping], FamilyInfo[Points[i][ClaimerTeam]][FamilyName]);
					SendClientMessage(playerid, COLOR_WHITE, szMessage);
					iCount++;
				}
				else
				{
					format(szMessage, sizeof(szMessage), "* %s | Capper: %s | Family: %s | Time left: %d minutes", Points[i][Name], Points[i][PlayerNameCapping], FamilyInfo[Points[i][ClaimerTeam]][FamilyName], Points[i][TakeOverTimer]);
					SendClientMessage(playerid, COLOR_WHITE, szMessage);
					iCount++;
				}
			}
		}
	}
	if(iCount == 0)
		return SendClientMessage(playerid, COLOR_GRAD2, "No family has capped the point or the point is not ready to be capped.");
	return 1;
}
Код:
CMD:points(playerid, params[])
{
	new string[128];

	for(new i; i < MAX_POINTS; i++)
	{
		if(Points[i][Type] >= 0)
		{
		    if(Points[i][Vulnerable] == -1)
		    {
		        format(string, sizeof(string), "Name: %s | Owner: %s | Captured By: %s | Hours: Temporarily disabled", Points[i][Name],Points[i][Owner],Points[i][CapperName]);
		    }
		    else
		    {
		        if(PlayerInfo[CapperName][pFaction] == 1 || PlayerInfo[CapperName][pLeader] == 1)
		        {
		            format(string, sizeof(string), "Name: %s | SHUTDOWN BY THE POLICE | Captured By: %s | Hours: %d", Points[i][Name],Points[i][CapperName],Points[i][Vulnerable]);
				}
				else
				{
					format(string, sizeof(string), "Name: %s | Owner: %s | Captured By: %s | Hours: %d", Points[i][Name],Points[i][Owner],Points[i][CapperName],Points[i][Vulnerable]);
				}
			}
			SendClientMessage(playerid, COLOR_WHITE, string);
		}
	}
	return 1;
}
And finally the LSPD Var
Код:
PlayerInfo[playerid][pFaction] or IsACop(playerid)
Reply
#2

Why not make it so Police can join the fight, and actually win the turf - instead of /shutdown. Just make them able to fight the criminals when they do it - and if IsACop wins, the turf becomes blue or w.e color you wish to symbol as "safe".

- Fred
Reply
#3

up master
Reply
#4

Quote:
Originally Posted by Fredrik
Посмотреть сообщение
Why not make it so Police can join the fight, and actually win the turf - instead of /shutdown. Just make them able to fight the criminals when they do it - and if IsACop wins, the turf becomes blue or w.e color you wish to symbol as "safe".

- Fred
code please
Reply
#5

Quote:
Originally Posted by Fredrik
Посмотреть сообщение
Why not make it so Police can join the fight, and actually win the turf - instead of /shutdown. Just make them able to fight the criminals when they do it - and if IsACop wins, the turf becomes blue or w.e color you wish to symbol as "safe".

- Fred
No, not a gang turf

i mean the RP Turfs? Point Wars?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)