SA-MP Forums Archive
Backup command. - 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)
+--- Thread: Backup command. (/showthread.php?tid=462708)



Backup command. - Beckett - 08.09.2013

Well that's what I made but I am looking forward to update the checkpoint, I mean when the player moves the checkpoint will update at his position, how to do that?

Код:
CMD:backup(playerid,params[])
{
	if(pInfo[playerid][LSPD] >= 1)
	{
		new string[126],Float:x, Float:y, Float:z;
		format(string,sizeof(string),"[Dispatch]: %s is requesting backup at %s!",RemoveUnderScore(playerid),GetPlayerArea(playerid));
		SendCopMessage(COLOR_BLUE,string);
		GetPlayerPos(playerid,x,y,z);
		SetPlayerCheckpoint(playerid,x,y,z,5.0);
	}
}



Re: Backup command. - Admigo - 08.09.2013

You should use a timer for that.
You can use onplayerupdate but i recom you to use a one second timer.


Re: Backup command. - Beckett - 08.09.2013

Oh you mean each one second the timer will get the player's position and display it? I'll try!


Re: Backup command. - Beckett - 08.09.2013

Works but another question how to make the checkpoint displays for cops? at the moment it's displaying for me only.


Re: Backup command. - Fierro - 08.09.2013

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Well that's what I made but I am looking forward to update the checkpoint, I mean when the player moves the checkpoint will update at his position, how to do that?

Код:
SetPlayerCheckpoint(playerid,x,y,z,5.0);
Your issue lies here. You're only setting the checkpoint for the player that uses /backup. For it to show for everyone else, you're going to need to manually SetPlayerCheckpoint for all other cops (maybe using a for statement) or you could create a command players can use to respond to requests for backup (/respond?).
Код:
CMD:backup(playerid,params[])
{
      //enter all the code you already have right here
     //the below example is if you want to give every cop your checkpoint without /respond
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
              if(IsCop[i]) //of course, this isn't the right variable, but you can enter that for yourself as this is just an example to help out
              {
                       SetPlayerCheckpoint(i,...) //fill in the parameters accordingly
              }
      }
}
Hope I helped


Re: Backup command. - Lidor124 - 08.09.2013

Quote:
Originally Posted by DaniceMcHarley
Посмотреть сообщение
Well that's what I made but I am looking forward to update the checkpoint, I mean when the player moves the checkpoint will update at his position, how to do that?

Код:
CMD:backup(playerid,params[])
{
	if(pInfo[playerid][LSPD] >= 1)
	{
		new string[126],Float:x, Float:y, Float:z;
		format(string,sizeof(string),"[Dispatch]: %s is requesting backup at %s!",RemoveUnderScore(playerid),GetPlayerArea(playerid));
		SendCopMessage(COLOR_BLUE,string);
		GetPlayerPos(playerid,x,y,z);
		SetPlayerCheckpoint(playerid,x,y,z,5.0);
	}
}
Look for ShowPlayerMarkers under OnGameModeInit if its valid and change it to PLAYER_MARKERS_MODE_GLOBAL
if this isn't exits on your gamemode so just create it under OngameModeinit ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
then put on your backup command:

Код:
new Float:slx, Float:sly, Float:slz;
GetPlayerPos(giveplayerid, slx, sly, slz);
SetPlayerMarkerForPlayer(playerid, giveplayerid, 0xFF0000AA); // 0xFF0000AA - whatever color you want - it will be keep tracking your target if he moves or changing positions.