How can I make a CP follow player ?
#1

Title says everything
I want to script a backup CMD which the CP remains on the player untill he aborts the backup
Reply
#2

If you are using a Roleplay script and you can't see other people on the mini-map, I'd suggest you using
https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer instead of setting a checkpoint always on the player that requires backup.

Here's an example with zcmd and foreach, it will make everyone who is a cop to see the the player who did /backup as a red marker on the mini-map:

Код:
CMD:backup(playerid, params[])
{
	foreach(Player, i)
	{
            if(playerid == i) continue;
	    if(IsPlayerCop(i)) 
            { 
                  SetPlayerMarkerForPlayer(i,playerid,0xFF0000FF); 
                  // Other code here..
            }
	}
	return 1;
}
Just change IsPlayerCop(i) with your variable that checks if the player is a cop.
Reply
#3

This is Scripting Help not Script for you.

You need a timer, updating the checkpoint for the active backup call, with a loop checking those who are needing to respond, and setting them with a checkpoint to the players location.

Another option is to set PlayerMarkers Global, and set the Alpha on all the players colors to 00 so they don't show up "normally" then set https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer for each who need to see them.

Setting the alpha makes them invisible via markers, yet chat and playertag color will stay normal.

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer instead of setting a checkpoint always on the player that requires backup.
Won't work unless player markers are set to GLOBAL. Gotta set that Global...
Reply
#4

Quote:
Originally Posted by Lucky13
Посмотреть сообщение
If you are using a Roleplay script and you can't see other people on the mini-map, I'd suggest you using
https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer instead of setting a checkpoint always on the player that requires backup.

Here's an example with zcmd and foreach, it will make everyone who is a cop to see the the player who did /backup as a red marker on the mini-map:

Код:
CMD:backup(playerid, params[])
{
	foreach(Player, i)
	{
            if(playerid == i) continue;
	    if(IsPlayerCop(i)) 
            { 
                  SetPlayerMarkerForPlayer(i,playerid,0xFF0000FF); 
                  // Other code here..
            }
	}
	return 1;
}
Just change IsPlayerCop(i) with your variable that checks if the player is a cop.
Haven't thought about that, good point
Thanks
Reply
#5

Again, pay attention, it won't work unless player markers are global, otherwise it'll be limited to a distance of 600, if that's what the stream distance for players is set to.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)