SA-MP Forums Archive
Only for cops. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Only for cops. (/showthread.php?tid=81348)



Only for cops. - -eXo - 10.06.2009

I'm trying to make this so it only shows up for factions 1 and 2, but it shows up for everyone when a cop requests backup.
Код:
	if(strcmp(cmd,"/backup",true)==0 || strcmp(cmd,"/bk",true)==0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
	    {
				if (PlayerInfo[playerid][pRequestingBackup] != 1)
				{
					GetPlayerName(playerid, sendername, sizeof(sendername));
					format(string, sizeof(string), "ALL UNITS: %s is requesting backup, they have been marked on your cruisers GPS (red).", sendername);
					PlayerInfo[playerid][pRequestingBackup] = 1;
					for(new i = 0; i < MAX_PLAYERS; i++)
					{
						if(IsPlayerConnected(i))
						{
							if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
	    {
								SetPlayerMarkerForPlayer(i, playerid, 0xFF0000FF);
								SendClientMessage(i, TEAM_BLUE_COLOR, string);
							}
						}
					}
					SendClientMessage(playerid, TEAM_BLUE_COLOR, "Type /bkc to clear your backup request.");
					SetTimerEx("BackupClear", 200000, false, "ii", playerid, 1);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "You already have an active backup request!");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "You are not a cop!");
			}
		}
		return 1;
	}


Thanks in advance to anyone that can help.


Re: Only for cops. - efeX - 10.06.2009

Post in the godfather topic.. not everyone here has seen/looks at the GF script.


Re: Only for cops. - -eXo - 10.06.2009

Quote:
Originally Posted by efeX
Post in the godfather topic.. not everyone here has seen/looks at the GF script.
It isn't GF.


Re: Only for cops. - efeX - 10.06.2009

Either way

if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)


So pMember = faction id?

that should work then.


Re: Only for cops. - -eXo - 10.06.2009

Yes, but for some reason the text and the playermarker shows up for everyone online, not just those 2 factions.


Re: Only for cops. - efeX - 10.06.2009

oh duh.

Код:
if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2)



Re: Only for cops. - -eXo - 13.06.2009

The marker still shows up for everyone.


Re: Only for cops. - [IB]Scorcher - 13.06.2009

Try && instead of ||