Define a colour to playerid variable [+1 rep]
#1

I want to make the id colour to this: 0x24FF0AB9 witch is light green...

code:

Код:
public OnPlayerText(playerid, text[])
{
  new string[128];
  format(string, sizeof(string),"[%d] %s",playerid, text);
  SendPlayerMessageToAll(playerid,string);
  return 0;
}
So here, I wanna make playerid to colour 0x24FF0AB9, but everytime I try to do it, always goes wrong
Reply
#2

You mean this?
pawn Код:
#define COLOR_GREEN 0x24FF0AB9
Reply
#3

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
You mean this?
pawn Код:
#define COLOR_GREEN 0x24FF0AB9
No, I mean making the id another color, in this case, making %d(playerid) color 0x24FF0AB9
Reply
#4

For that you should seperate the player team.
Reply
#5

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
For that you should seperate the player team.
Nah, I don't wanna do teams.. just want to have a function like "SetPlayerColor(playerid, 0xFA8072FF);" but for the id.. not the nickname.
Reply
#6

pawn Код:
switch(playerid)
{
    case 0: SetPlayerColor(playerid, 0x24FF0AB9); // Sets green color to playerid 0.
    case 1: // Same here with color you want for id 1.
}
Its one way to do it, but alot of work if you want evey single player with different colors. That one can be used after login to set player color.

Here is another way of doing it, under OnPlayerText;
pawn Код:
switch(playerid)
{
    case 0: SendClientMessageToAll(0x24FF0AB9, text);
    case 1: // Same here with color you want for id 1.
}
Reply
#7

Quote:
Originally Posted by Richie
Посмотреть сообщение
pawn Код:
switch(playerid)
{
    case 0: SetPlayerColor(playerid, 0x24FF0AB9); // Sets green color to playerid 0.
    case 1: // Same here with color you want for id 1.
}
Its one way to do it, but alot of work if you want evey single player with different colors. That one can be used after login to set player color.

Here is another way of doing it, under OnPlayerText;
pawn Код:
switch(playerid)
{
    case 0: SendClientMessageToAll(0x24FF0AB9, text);
    case 1: // Same here with color you want for id 1.
}
It's not that, I want the id to change of colour, not the nickname....

when someone says something, it looks like this:

PlayerX: [0] I'm talking

[0] = id, I want this part to be colored as green... if the 0(id) is not possible to change the colour, then it whould be enough to change the [ ] colours.
Reply
#8

Of what I can understand, you need to get "GetPlayerColor"'s format into the colour embedding format. In that case, this thread should be great to check: https://sampforum.blast.hk/showthread.php?tid=249575

EDIT: If all ids should be this colour, I guess you can just add {24FF0A} in front of the id. And then {FFFFFF} behind (so the message is white).
Reply
#9

Use colour embedding {RGB color here}.
pawn Код:
public OnPlayerText(playerid, text[])
{
  new string[128];
  format(string, sizeof(string),"{24FF0A}[%d]{FFFFFF} %s",playerid, text);
  SendPlayerMessageToAll(playerid,string);
  return 0;
}
First I turn the playerid to green then the message to white.
Edit: Changed a thing in the code.
Reply
#10

Quote:
Originally Posted by Fj0rtizFredde
Посмотреть сообщение
Use colour embedding {RGB color here}.
pawn Код:
public OnPlayerText(playerid, text[])
{
  new string[128];
  format(string, sizeof(string),"{24FF0A}[%d]{FFFFFF} %s",playerid, text);
  SendPlayerMessageToAll(-1,string);
  return 0;
}
First I turn the playerid to green then the message to white.
Now nothing appears when chatting..

code:

public OnPlayerText(playerid, text[])
{
new string[128];
format(string, sizeof(string),"{00FF00}[%d]{FFFFFF} %s",playerid, text);
SendPlayerMessageToAll(-1,string);
return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)