Colors
#1

Hi all , i never understand this function with random...and i want to make something with colors .

When 1 player enter in game (OnPlayerConnect) i want to give him random color...i maked this :

Код:
new PlayerColors[200] = {
0xFF8C13FF,0xC715FFFF,0x20B2AAFF,0xDC143CFF.....
};
And at OnPlayerConnect:

Код:
SetPlayerColor(playerid, PlayerColors[playerid]);
But ... no effect . What i can do ?

PS: Srry for my bad englesh...i am from italy.
Reply
#2

Maybe this will help you https://sampwiki.blast.hk/wiki/ColorFix
Reply
#3

i sayd , i maked it but don't work , i don't know why it will set me only orange color
Reply
#4

SetPlayerColor(playerid, PlayerColors[random(sizeof PlayerColors)]);
Reply
#5

ty Seif . Solved
Reply
#6

Solved+Edit:

How i can make , when 1 player use /invisible another player to don't see hes nick name ?
Reply
#7

PHP код:

// In OnPlayerCommandText
if(strcmp(cmd"/invisible"true) == 0)
{
for (new 
0MAX_PLAYERSi++)
{
    
ShowPlayerNameTagForPlayer(playeridi0);
}
SendClientMessage(playerid, -1"{9ACD32}[Update]{FFFFFF} Now nobody can see your nickname !");
return 
1;

No indentation, but the essential is here.
Reply
#8

S4t3K , ty but it don't work ... when 1 player type /invisible all players can see hes name and health+armour...

Код:
CMD:invisible(playerid,params[])
{
	if(IsPlayerAdmin(playerid) || AccInfo[playerid][Level] >= 5)
	{
		if(AccInfo[playerid][Hide] == 0)
		{
		    AccInfo[playerid][pColor] = GetPlayerColor(playerid);
			SetPlayerColor(playerid, 0xFFFFFF00);
   			GameTextForPlayer(playerid, "~n~~n~~n~~n~~g~Invisible!",2500,3);
   			AccInfo[playerid][Hide] = 1;
   			if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
   			{
   	    		new int1 = GetPlayerInterior(playerid);
   	    		LinkVehicleToInterior(GetPlayerVehicleID(playerid),int1+1);
   	    		for (new i = 0; i < MAX_PLAYERS; i++)
				{
				    ShowPlayerNameTagForPlayer(playerid, i, 0);
				}
    		}
    		return 1;
		}
		else return SendClientMessage(playerid, lightred,"ERROR: You are already Invisible!");
	}
	else return  ErrorMessages(playerid, 1);
}
+...how i can make 1 "update" at this...

Код:
if(AccInfo[playerid][Level] > 0 && AccInfo[playerid][Hide] == 0)
	{
	    new str3[256];
		new name[MAX_PLAYER_NAME];
		GetPlayerName(playerid, name, sizeof(name));
		format(str3, 256, "%s{0000FF}(Admin){15FF00}(%d):{FFFFFF} %s",name, playerid, text);
		SendClientMessageToAll(GetPlayerColor(playerid), str3);
		return 0;
	}
but...to show at head when 1 player say something , like SendPlayerMessageToAll
Reply
#9

....up
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)