SA-MP Forums Archive
SetPlayerMarkerForPlayer invisible bug? - 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: SetPlayerMarkerForPlayer invisible bug? (/showthread.php?tid=350951)



SetPlayerMarkerForPlayer invisible bug? - ombre - 14.06.2012

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.


Re: SetPlayerMarkerForPlayer invisible bug? - MP2 - 14.06.2012

You're probably setting their color in OnPlayerSpawn.


Re: SetPlayerMarkerForPlayer invisible bug? - iggy1 - 14.06.2012

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.


Re: SetPlayerMarkerForPlayer invisible bug? - $$inSane - 14.06.2012

check out your public OnPlayerDeath..
its a fluke

or set Invisible On spawn


Re : SetPlayerMarkerForPlayer invisible bug? - ombre - 14.06.2012

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.


Re: Re : SetPlayerMarkerForPlayer invisible bug? - iggy1 - 14.06.2012

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.


Re : SetPlayerMarkerForPlayer invisible bug? - ombre - 14.06.2012

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.


Re : SetPlayerMarkerForPlayer invisible bug? - ombre - 14.06.2012

it's confirmed? Someone has tested?