Make a player marker invisible
#1

Hi

How do I make a players marker on the map invisible?

I cant use "ShowPlayerMarkers(0);" because I need it so
when a admin goes on duty it will show the admin on the map.
and then when he goes off admin duty then he will be invisible again...

Code:
CMD:adminduty(playerid, params[])
{
	if(pInfo[playerid][pAdminLevel] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not authorised to use that command.");
	if(GetPVarInt(playerid, "AdminDuty") == 0)
	{
		new str[126];
		SetPlayerColor(playerid, 0xFF9900AA);
		format(str, sizeof(str), "%s is now on duty.", GetName(playerid));
		SendClientMessageToAdmins(COLOR_ORANGE, str, 1);
		SendClientMessageToAll(COLOR_ORANGE, "There is an admin on duty.");
		SetPVarInt(playerid, "AdminDuty", 1);
		return 1;
	}
	if(GetPVarInt(playerid, "AdminDuty") == 1)
	{
		new str[126];
		SetPlayerColor(playerid, 0xFFFFFFFF);
		format(str, sizeof(str), "%s is now off duty.", GetName(playerid));
		SendClientMessageToAdmins(COLOR_ORANGE, str, 1);
		SetPVarInt(playerid, "AdminDuty", 0);			
	}
	return 1;
}
Reply
#2

Just set the alpha to 0 of course

example
SetPlayerMarkerForPlayer(playerid, forplayer, 0xFFFFFF00);
Reply
#3

SetPlayerColor(playerid, GetPlayerColor(playerid) & 0xFFFFFF00);
SetPlayerColor(playerid, GetPlayerColor(playerid) & ~0xFF);

These are the best methods, using Pottus's you would need to loop through each other player... Mine keeps the players color in the chat and stuff the same, but it's invisible on the mini map...

Not sure if it's correct, but almost 100% sure it is :P... If one doesn't work, try the other, both should work though!
Reply
#4

So I put SetPlayerColor(playerid, GetPlayerColor(playerid) & 0xFFFFFF00);
under the Admin Duty command, and it works fine, but I put it under the
OnPlayerConnect and it doesnt work... To make my marker invisible I have
to go on Admin duty and then off duty before it goes invisible

Edit:
Ok I got it working, it was setting their color to white when they logged in.

Thank you for your help guys
Reply
#5

Quote:
Originally Posted by Crayder
View Post
SetPlayerColor(playerid, GetPlayerColor(playerid) & 0xFFFFFF00);
SetPlayerColor(playerid, GetPlayerColor(playerid) & ~0xFF);

These are the best methods, using Pottus's you would need to loop through each other player... Mine keeps the players color in the chat and stuff the same, but it's invisible on the mini map...

Not sure if it's correct, but almost 100% sure it is :P... If one doesn't work, try the other, both should work though!
I guess that could work now looking back I realize the reason I do that is because I want certain players to see other players
Reply
#6

Quote:
Originally Posted by Pottus
View Post
I guess that could work now looking back I realize the reason I do that is because I want certain players to see other players
Yea I know I use your method for separate team's visibility, and certain things like that,
but for this purpose it's better to use the binary to combine the colors.

0xFFFF00FF & 0xFFFFFF00 = 0xFFFF0000
Here using 0xFFFFFF00, I keep 255 of the red green and blue, but none of the alpha.

0xFFFF00FF & 0xAAAAAAAA = 0xAAAA00AA
Here using 0xAAAAAAAA, I only keep 170 of each part.

And finally, 0xFFAA80CC & 0x80808080 = 0x802A004C <- I think this is right :/ (Someone check!)
Here using 0xDEDEDEDE, I only keep 128 of each part.

This technique could be used for multiple things, such as making colors brighter, darker,
or even more dull or gray. It does take minor knowledge but here ya go!
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)