Id Infront of name
#1

GUyss i guess its damn simple but i dont know it.couldnt find it on search also. when people send a chat message.. i want it in this format :-

[ID]Name : *Message

i dont know how to do it
Reply
#2

// I see someone got it here.
Reply
#3

pawn Code:
public OnPlayerText(playerid, text[])
{
     new string[128];
     format(string,sizeof(string),"[%i]%s: %s",playerid,GetPName(playerid),text);
     SendClientMessageToAll(GetPlayerColor(playerid),string);
     return 0;
}
Reply
#4

all right thanks for that .. but one more thing.. i want my text to be normal white colours.. and my ID to be Yellow in colour.. also there is a little bug that.. when i enter the server.. my colour is always black
Reply
#5

pawn Code:
public OnPlayerText(playerid, text[])
{
     new string[128];
     format(string,sizeof(string),"{FFFF00}[%i]{FFFFFF}%s: %s",playerid,GetPName(playerid),text);
     SendClientMessageToAll(GetPlayerColor(playerid),string);
     return 0;
}
SetPlayerColor(playerid, 0xFFFFFFAA); // OnPlayerConnect or OnplayerSpawn
Reply
#6

Its Not Helping... i mean i get the ID there.. bug i want the ID to be in YELLOW color and the Name to be in PLayer's Colour and the Text in WHITE
Reply
#7

https://sampwiki.blast.hk/wiki/Colors_List
Reply
#8

Ohh .. wait up
Reply
#9

Code:
public OnPlayerText(playerid, text[])
{
     new string[128];
     new Pname[256];
	 GetPlayerName(playerid,Pname,256);
	 format(string,sizeof(string),"{FFDC00}[%i] - %s : {FFFFFF}%s",playerid,Pname,text);
     SendClientMessageToAll(GetPlayerColor(playerid),string);
     return 0;
}
i need the middle %s to have player's colour
Reply
#10

pawn Code:
public OnPlayerText(playerid, text[])
{
     static string[128];
     GetPlayerName(playerid, string, MAX_PLAYER_NAME); // fix name

     format(string,sizeof string ,"[%d] %s:{FFFFFF} %s",playerid, string,text); // fix colour :d

     SendClientMessageToAll(GetPlayerColor(playerid),string);
     return 0;    
}
sdp and Jafet_Macario:
Your code send all messages with color FFDC00 and FFFF00

Blood
Your code cause undefined symbol, and send ALL message with one color
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)