PDA

View Full Version : Admin name Color


BlackbirdXd
13/02/2017, 04:13 PM
Hello, I was playing around with parameters,


CMD:sendtols(playerid, params[])
{
new sendtolsplayerid;
if(sscanf(params, "u", sendtolsplayerid))
{
return SendClientMessage(playerid, COLOR_RED, "Usage: /sendtols [Playerid]");
}
if(sendtolsplayerid == INVALID_PLAYER_ID)
{
return SendClientMessage(playerid, COLOR_RED, "You entered Invalid Player ID");
}
else
{
new adminname[MAX_PLAYER_NAME], adminid = playerid;
GetPlayerName(playerid, adminname, sizeof(adminname));
new message[24];
SetPlayerPos(sendtolsplayerid, 1521.5381, -1677.6841, 13.5469);
format(message,sizeof(message), "%s[%d]", adminname, adminid);
SendClientMessage(sendtolsplayerid, COLOR_WHITE, "You have been teleported by {b0fc2d}message");

}
return 1;
}


As you can see I formatted adminname and adminid in message string, Now I want when someone use /sendtols playerid the one who get teleported by admin Gets the message "You have been teleported by Adminname[Adminid]" I know how to do this but my problem is how do I color adminname and adminid?

Unrea1
13/02/2017, 04:25 PM
CMD:sendtols(playerid, params[])
{
if(sscanf(params, "u", params[0]))
{
return SendClientMessage(playerid, COLOR_RED, "Usage: /sendtols [Playerid]");
}
if(!IsPlayerConnected(playerid))
{
return SendClientMessage(playerid, COLOR_RED, "You entered invalid player ID.");
}
new adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminname, sizeof(adminname));
new string[70];
format(string,sizeof(string), "You have been teleported by {b0fc2d}%s[%d]", adminname, playerid);
SendClientMessage(params[0], COLOR_WHITE, string);
SetPlayerPos(params[0], 1521.5381, -1677.6841, 13.5469);
return 1;
}

BlackbirdXd
13/02/2017, 04:33 PM
CMD:sendtols(playerid, params[])
{
if(sscanf(params, "u", params[0]))
{
return SendClientMessage(playerid, COLOR_RED, "Usage: /sendtols [Playerid]");
}
if(!IsPlayerConnected(playerid))
{
return SendClientMessage(playerid, COLOR_RED, "You entered invalid player ID.");
}
new adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, adminname, sizeof(adminname));
new string[70];
format(string,sizeof(string), "You have been teleported by {b0fc2d}%s[%d]", adminname, playerid);
SendClientMessage(params[0], COLOR_WHITE, string);
SetPlayerPos(params[0], 1521.5381, -1677.6841, 13.5469);
return 1;
}

Didn't knew that we can also embed color while formatting thanks.