ShowPlayerMarkers or others
#1

Hi,

I want to have on the mini map:

If the players are a radius of 100 yards to me I don't see the PlayerMarkers but if they are step further that 100 yards I can see the PlayerMarkers. Inverse of LimitPlayerMarkerRadius(100.0);

Thanks
Reply
#2

This is from the SA-MP wiki
Quote:

SetPlayerMarkerForPlayer(playerid, showplayerid, color);

// Make player 42 see player 1 as a red marker
SetPlayerMarkerForPlayer( 42, 1, 0xFF0000FF );

// Make the players marker an invisible white (chat will be white but marker will be gone).
SetPlayerMarkerForPlayer( 42, 1, 0xFFFFFF00 );

// Make the players marker invisible to the player while keeping chat colour the same. Will only work correctly if SetPlayerColor has been used:
SetPlayerMarkerForPlayer( 42, 1, ( GetPlayerColor( 1 ) & 0xFFFFFF00 ) );

ShowPlayerNameTagForPlayer(playerid, shownplayerid, true/false);

Now, let's use this in OnPlayerUpdate
pawn Код:
public OnPlayerUpdate(playerid) {
    new     Float: pX,
        Float: pY,
        Float: pZ;
    GetPlayerPos(playerid, pX, pY, pZ);
    for(new pID = 0; pID < MAX_PLAYERS; pID++) {
        if(IsPlayerInRangeOfPoint(pID, 100.0, pX, pY, pZ)) {
            SetPlayerMarkerForPlayer(playerid, pID, ( GetPlayerColor(pID) & 0xFFFFFF00 ));
            ShowPlayerNameTagForPlayer(playerid, pID, false);
        } else {
            SetPlayerMarkerForPlayer(playerid, pID, GetPlayerColor(pID));
            ShowPlayerNameTagForPlayer(playerid, pID, true);
        }
    }
    return true;
}
And this should make it so...
- If the player is within 100yards of the other player, the marker will appear to be invisible but it is not fully disabled and their marker will be disabled for the other player.
- If the player is not within 100yards of the other player, the marker will appear on the mini-map as the player's color and their marker will be enabled for the other player.

Will only work if...
- SetPlayerColor(playerid, color); was used on all players.

Hope you learned a thing or two.
If you need more help please feel free to add my Skype: TheLazySloth and I will help you with whatever you may need.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)