Police Back-Up Help
#1

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?
Reply
#2

You have to show your code...
Reply
#3

Very true....would help alot
Reply
#4

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");
			}
		}
Reply
#5

Bump ^
Reply
#6

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

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)