/back cmd
#1

Ok so i was wondering how would i make my back up so it shows a red circle maker what follows the officer

Код:
CMD:backup(playerid, params[])
{
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5)
	{
		if (Backup[playerid] != 1)
		{
			new
				zone[MAX_ZONE_NAME],
				string[40 + MAX_PLAYER_NAME];

			GetPlayer3DZone(playerid, zone, sizeof(zone));
			format(string, sizeof(string), "* %s requests backup over their radio.", GetPlayerNameEx(playerid));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
			format(string, sizeof(string), "%s is requesting immediate backup at %s.", GetPlayerNameEx(playerid), zone);
            Backup[playerid] = 1;
			foreach(Player, i)
   {
				if(gTeam[i] == 2 || IsACop(i))
				{
      				SetPlayerMarkerForPlayer(i, playerid, 0x2641FEAA);
					SendClientMessageEx(i, TEAM_BLUE_COLOR, string);
				}
			}
			SendClientMessageEx(playerid, COLOR_WHITE, "Type /nobackup to clear your backup request.");
			SetTimerEx("BackupClear", 180000, false, "ii", playerid, 1);
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "  You already have an active backup request!");
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GRAD2, "   You are not a Cop / FBI / Coastguard!");
	}
	return 1;
}
Reply
#2

You would need a timer that is called every second and updates the marker. For example, in /backup you could put:

Код:
//This goes at the top of the script somewhere
new BackupTimer[MAX_PLAYERS];

BackupTimer[playerid] = SetTimerEx("BackupTimer", 1000, true, "i", playerid);
And then the timer would be:

Код:
forward BackupTimer(playerid);
public BackupTimer(playerid)
{
	new Float:pPos[3];
	GetPlayerPos(playerid, pPos[0], pPos[1], pPos[2]);
	foreach(Player, i)
	{
		if(gTeam[i] == 2 || IsACop(i))
		{
			SetPlayerCheckpoint(i, pPos[0], pPos[1], pPos[2], 5.0);
		}
	}
}
And wherever you cancel the backup or however it gets ended you can put:

Код:
KillTimer(BackupTimer[playerid]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)