Make players marker on map invissible
#1

Make players marker on map invissible
______________________________________

Hey I need help I got this:

Код:
                                for(new i = 0; i < MAX_PLAYERS; i++)
				{
				    if(IsPlayerConnected(i))
				    {
					    if(gTeam[i] == 1)
					    {
					        SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid) & RED));
					    }
					}
				}
			        if(vietnamhasplane == true)
				{
					for(new i = 0; i < MAX_PLAYERS; i++)
					{
						if(IsPlayerConnected(i))
						{
							if(gTeam[i] == 1)
							{
								players = i;
							}
							else if(gTeam[i] == 2)
							{
								SetPlayerMarkerForPlayer(i, players, (GetPlayerColor(playerid) & BLUE));
							}
						}
					}
				}
				if(usahasplane == true)
				{
				    for(new i = 0; i < MAX_PLAYERS; i++)
					{
						if(IsPlayerConnected(i))
						{
							if(gTeam[i] == 2)
							{
								players = i;
							}
							else if(gTeam[i] == 1)
							{
								SetPlayerMarkerForPlayer(i, players, (GetPlayerColor(playerid) & RED));
							}
						}
					}
				}
I want to make the player invissible to the other team, but I fail. Wut should I do?
Reply
#2

Quote:

0xFFFFFF00

Takes the player's color and does a bitwise AND with 0xFFFFFF00.
This keeps the RGB (red, green, blue) part of the player's color but makes the Alpha (the last "00") 0, making the player's dot on the radar completely transparent.
If the player's color was 0x00FF00FF (green and full alpha), the color is set to 0x00FF0000 after this.

Or you could do this:


Quote:

At top of your script:

//team ----------------
static gTeam[MAX_PLAYERS];


Define the colors:

#define COLOR_INVISIBLE 0xFF000000
#define COLOR_RED 0xFF0000AA


Put this at "OnPlayerSpawn":

SetPlayerMarkerForPlayer(playerid, gTeam[playerid]==1, COLOR_BLUE);
SetPlayerMarkerForPlayer(playerid, gTeam[playerid]==0, COLOR_INVISIBLE);


Put this at the command which will allow you to see the enemy on the radar:

SetPlayerMarkerForPlayer(playerid, gTeam[playerid]==0, COLOR_RED);

Quote:
Explanation

SetPlayerMarkerForPlayer

Parameters:

(playerid, showplayerid, color)

playerid The player whose view you want to change

showplayerid The player whose color will be changed

color New color. Set the alpha part to 00 for an invisible blip.
This works because 00 will set the transparency to
nothing, which is invisible.



Код:
---------------------------------------------------------------------------------------------------------------

// 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 ) );
 
// Make the players marker fully opaque (solid) to the player while keeping chat colour the same. Will only work correctly if SetPlayerColor has been used:
SetPlayerMarkerForPlayer( 42, 1, ( GetPlayerColor( 1 ) | 0x000000FF ) );
---------------------------------------------------------------------------------------------------------------
-

Код:
// Is not your team
gTeam[playerid]==0 

// Is your team
gTeam[playerid]==1
I think I've brought you pretty far with this right?
Good luck!

p.s. if you got any further questions, don't hasitate and ask me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)