Yes, you would use the
ShowPlayerMarkerForPlayerfunction inside of a loop, to set all players marker. You would probably also need a variable to set so if new players join the server, it will automatically set their markers hidden.
pawn Code:
//global variable
new set_markers;
public OnPlayerConnect( playerid )
{
if( set_markers == 1 )
{
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if( !IsPlayerConnected( i ) ) continue;
ShowPlayerMarkerForPlayer( i, playerid, 0xFFFFFF00 ); // Have 'i' radar hide playerid marker
ShowPlayerMarkerForPlayer( playerid, i, 0xFFFFFF00 ); // Have 'playerid' radar hide i marker
}
}
return 1;
}
ZCMD:markers( playerid, params[ ] )
{
if( !IsPlayerAdmin( playerid ) ) return 1;
for( new i = 0; i < MAX_PLAYERS; i++ )
{
if( !IsPlayerConnected( i ) ) continue;
for( new z = 0; z < MAX_PLAYERS; z++ )
{
if( !IsPlayerConnected( z ) ) continue;
if( i == z ) continue;
ShowPlayerMarkerForPlayer( i, z, 0xFFFFFF00 );
ShowPlayerMarkerForPlayer( z, i, 0xFFFFFF00 );
}
}
set_markers = 1;
return 1;
}
Please note that this will also change the players color in the chat box. For more imformation on how to avoid that and details on the function itself, check the wiki page:
https://sampwiki.blast.hk/wiki/SetPlayerMarkerForPlayer
There also may be a much simpler way of doing this. However, I've never used or tested this method so cannot be sure - Using LimitPlayerMarkerRadius
pawn Code:
COMMAND:markers( playerid, params[ ] )
{
if( !IsPlayerAdmin( playerid ) ) return 1;
LimitPlayerMarkerRadius( 0.1 );
return 1;
}
However, I'm unaware of whether that function can only be used inside OnGameModeInit or not.