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



Police Back-Up Help - Anthony_Lloyd101 - 23.03.2010

Hello everyone, I am having a problem with the police back up method. When a cop types /backup a red dot is suppose to display on the radar and all officers should be able to see it and go to his direction but the red target does not show up at all. Any help?


Re: Police Back-Up Help - Mike Garber - 23.03.2010

You have to show your code...


Re: Police Back-Up Help - Steven82 - 23.03.2010

Very true....would help alot


Re: Police Back-Up Help - Anthony_Lloyd101 - 23.03.2010

Lol that would help. sorry i forgot like a dummy.


Код:
if(strcmp(cmd, "/backup", true) == 0 || strcmp(cmd, "/bk", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
			if(PlayerInfo[playerid][pFaction] != 255 && DynamicFactions[PlayerInfo[playerid][pFaction]][fType] == 1)
  			{
				if(CopOnDuty[playerid] == 0)
				{
 					SendClientMessage(playerid, COLOR_GREY, "(ERROR) You are not on duty");
  					return 1;
 				}
				if (PlayerInfo[playerid][pRequestingBackup] != 1)
				{
					GetPlayerName(playerid, sendername, sizeof(sendername));
					new Float:L, Float:R, Float:E;
					GetPlayerPos(playerid, L, R, E);
					format(string, sizeof(string), "(RADIO) All units, %s is requesting immediate assistance, location marked on the map (red)", sendername);
					PlayerInfo[playerid][pRequestingBackup] = 1;
					for(new i = 0; i < MAX_PLAYERS; i++)
					{
						if(IsPlayerConnected(i))
						{
							if(PlayerInfo[i][pFaction] == 0 || PlayerInfo[i][pFaction] == 6)
							{
								SetPlayerCheckpoint(playerid, L, R, E-10, 1.0);
								SendClientMessage(i, COLOR_LSPD, string);
							}
						}
					}
					SendClientMessage(playerid, COLOR_WHITE, "(INFO) Type /backupclear or /bkc to clear your backup request");
					SetTimerEx("BackupClear", 180000, false, "ii", playerid, 1);
				}
				else
				{
					SendClientMessage(playerid, COLOR_GREY, "(ERROR) You already have an active backup request");
				}
			}
			else
			{
				SendClientMessage(playerid, COLOR_GREY, "(ERROR) Invalid faction");
			}
		}



Re: Police Back-Up Help - Anthony_Lloyd101 - 24.03.2010

Bump ^


Re: Police Back-Up Help - SiJ - 24.03.2010

SetPlayerCheckpoint(playerid, L, R, E-10, 1.0);
should be
SetPlayerCheckpoint(i, L, R, E-10, 1.0);


Re: Police Back-Up Help - VirSpectorX - 24.03.2010

Wrong! This part

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
                    {
                        if(IsPlayerConnected(i))
                        {
                            if(PlayerInfo[i][pFaction] == 0 || PlayerInfo[i][pFaction] == 6)
                            {
                                SetPlayerCheckpoint(playerid, L, R, E-10, 1.0);
                                SendClientMessage(i, COLOR_LSPD, string);
                            }
                        }
                    }
As you can see:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
And what you make is:
pawn Код:
SetPlayerCheckpoint(playerid, L, R, E-10, 1.0);
So, it should be like this:
pawn Код:
SetPlayerCheckpoint(i, L, R, E-10, 1.0);
Simply change the playerid with i