SetPlayerMarkerForPlayer invisible bug?
#1

Hi,

Код:
if(strcmp(cmd, "/invisible", true) == 0)
	{
		for(new i=0; i < MAX_PLAYERS; i++)
	    {
	        if (IsPlayerConnected(i))
	        {
	            SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( i ) & 0xFFFFFF00 ) );
	            SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( playerid ) & 0xFFFFFF00 ) );
	        }
	    }
	    return 1;
	}
After this command we are invisble on the icon map but If I kill the player if he comes back near to me, we see the icon on the map, it's a bug? How to resolve that? Thanks.
Reply
#2

You're probably setting their color in OnPlayerSpawn.
Reply
#3

Sounds like you need to set them back to invisible when they spawn.

pawn Код:
new gPlayerInvisible[ MAX_PLAYERS char ];//global var

if(strcmp(cmd, "/invisible", true) == 0)
{
    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( i ) & 0xFFFFFF00 ) );
            SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( playerid ) & 0xFFFFFF00 ) );
        }
    }
    gPlayerInvisible{ playerid } = true;//to detect if player is invisible when they spawn
    return 1;
}
   
   
//OnPlayerSpawn

if( gPlayerInvisible{ playerid } )
{

    for(new i=0; i < MAX_PLAYERS; i++)
    {
        if (IsPlayerConnected(i))
        {
            SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( i ) & 0xFFFFFF00 ) );
            SetPlayerMarkerForPlayer( i, playerid, ( GetPlayerColor( playerid ) & 0xFFFFFF00 ) );
        }
    }

}
I'm not sure if that's a bug or not. It's more than likely what MP2 posted is causing the problem^^.

EDIT: Don't forget to set "gPlayerInvisible" to false when the player is visible again if you use the above code.
Reply
#4

check out your public OnPlayerDeath..
its a fluke

or set Invisible On spawn
Reply
#5

MP2 I use only SetPlayerColor(playerid, 0x33AA33AA); in OnPlayerConnect.
SetPlayerMarkerForPlayer in OnPlayerSpawn don't work. and why callback SetPlayerMarkerForPlayer after a spawn?

You need to test for to see.
Reply
#6

Quote:
Originally Posted by ombre
Посмотреть сообщение
and why callback SetPlayerMarkerForPlayer after a spawn?
Because
Quote:
Originally Posted by ombre
Посмотреть сообщение
If I kill the player if he comes back near to me, we see the icon on the map
Try looking through your other (loaded) filterscripts to see if they use SetPlayerMarkerForPlayer.
Reply
#7

no I use only the GM lvdm in test.

Are you sure I need after a spawn callback SetPlayerMarkerForPlayer because when I kill the player I can see him only ( him also can see me) if he is near to me, Otherwise Icant.
Reply
#8

it's confirmed? Someone has tested?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)