Admin orange name
#1

How can I make it so when admins do /b it colors like this (( Admin_Name: hello))

but for non admins it still says (( Civ_Name: hi))

and testers it says (( Tester_Name: Hi))

i can also skype call and team view just pm me for skype
Reply
#2

Hi !
You can do something like :
Код:
(On the command)
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
switch(ADMINVARIABLE)
{
	case 1: format(message, sizeof(message),"(("{F81414}"%s"{FFFFFF}" : %s ))", PlayerName, string); // If the Admin variable of the player is equal to 1, they are testers, so the name is in red
	case 2: format(message, sizeof(message), "(("{FFAF00}"%s"{FFFFFF}" : %s ))", PlayerName, string); // If the Admin variable of the player is equal to 2, they are admins, so the name is in orange
	default:  format(message, sizeof(message), "(( %s : %s ))", PlayerName, string); // If the Admin variable of the player isn't one or two, the message is white

}
SendClientMessageToAll(-1, message);
Reply
#3

Quote:
Originally Posted by petrux
Посмотреть сообщение
Hi !
You can do something like :
Код:
(On the command)
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
switch(ADMINVARIABLE)
{
	case 1: format(message, sizeof(message),"(("{F81414}"%s"{FFFFFF}" : %s ))", PlayerName, string); // If the Admin variable of the player is equal to 1, they are testers, so the name is in red
	case 2: format(message, sizeof(message), "(("{FFAF00}"%s"{FFFFFF}" : %s ))", PlayerName, string); // If the Admin variable of the player is equal to 2, they are admins, so the name is in orange
	default:  format(message, sizeof(message), "(( %s : %s ))", PlayerName, string); // If the Admin variable of the player isn't one or two, the message is white

}
SendClientMessageToAll(-1, message);
Why are you using literal color values? The color values encased in curly brackets belong inside the string.

This code would spit out errors if those aren't defined AFAIK.
Reply
#4

Quote:
Originally Posted by petrux
Посмотреть сообщение
Hi !
You can do something like :
Код:
(On the command)
new PlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
switch(ADMINVARIABLE)
{
	case 1: format(message, sizeof(message),"(("{F81414}"%s"{FFFFFF}" : %s ))", PlayerName, string); // If the Admin variable of the player is equal to 1, they are testers, so the name is in red
	case 2: format(message, sizeof(message), "(("{FFAF00}"%s"{FFFFFF}" : %s ))", PlayerName, string); // If the Admin variable of the player is equal to 2, they are admins, so the name is in orange
	default:  format(message, sizeof(message), "(( %s : %s ))", PlayerName, string); // If the Admin variable of the player isn't one or two, the message is white

}
SendClientMessageToAll(-1, message);
Ok so where do i place this?
Reply
#5

In OnPlayerText.

Check if the admin's level is n (n = whatever number you want) then format the message with the color you want, else .. then this color etc.
Don't forget to return false/0 at the end of the callback.
Reply
#6

Quote:
Originally Posted by Dwane
Посмотреть сообщение
In OnPlayerText.

Check if the admin's level is n (n = whatever number you want) then format the message with the color you want, else .. then this color etc.
Don't forget to return false/0 at the end of the callback.
Im pretty new, what does return false/0 at the end of callback mean?
Reply
#7

pawn Код:
public OnPlayerText(playerid, text[])
{
    // code here
    return 0; // <-- returning false/0 at the end of the callback, it will send the custon chat.
}
Reply
#8

Quote:
Originally Posted by Dwane
Посмотреть сообщение
In OnPlayerText.

Check if the admin's level is n (n = whatever number you want) then format the message with the color you want, else .. then this color etc.
Don't forget to return false/0 at the end of the callback.
What you mean with n? if i want it so level 7 admins are orange what i do?
Reply
#9

I misunderstood. I thought when they chat, but you want it only in /b command.

Something like that will work:
pawn Код:
CMD:b(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /b <text>");
    new
        msg[ 128 ],
        name[ 24 ]
    ;
    GetPlayerName(playerid, name, 24);
    if(Player[playerid][Admin] == 7) format(msg, 128, "{FF9600}Admin_%s: {FFFFFF}%s", name, params);
    else if(Player[playerid][Admin] == 2) format(msg, 128, "{FF0000}Tester_%s: {FFFFFF}%s", name, params);
    else format(msg, 128, "Civ_%s: %s", name, params);
    SendClientMessageToALL(-1, msg);
    return 1;
}
Reply
#10

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I misunderstood. I thought when they chat, but you want it only in /b command.

Something like that will work:
pawn Код:
CMD:b(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, -1, "Usage: /b <text>");
    new
        msg[ 128 ],
        name[ 24 ]
    ;
    GetPlayerName(playerid, name, 24);
    if(Player[playerid][Admin] == 7) format(msg, 128, "{FF9600}Admin_%s: {FFFFFF}%s", name, params);
    else if(Player[playerid][Admin] == 2) format(msg, 128, "{FF0000}Tester_%s: {FFFFFF}%s", name, params);
    else format(msg, 128, "Civ_%s: %s", name, params);
    SendClientMessageToALL(-1, msg);
    return 1;
}
thanks but when i replace it with me old /b cmd i get these warnings on compile

C:\Users\nathan\Desktop\GTA SA Mod & stuff\Servers\samp03x_svr_win32 (1)\gamemodes\CentralRp.pwn(11409) : error 017: undefined symbol "Player"
C:\Users\nathan\Desktop\GTA SA Mod & stuff\Servers\samp03x_svr_win32 (1)\gamemodes\CentralRp.pwn(11409) : warning 215: expression has no effect
C:\Users\nathan\Desktop\GTA SA Mod & stuff\Servers\samp03x_svr_win32 (1)\gamemodes\CentralRp.pwn(11409) : error 001: expected token: ";", but found "]"
C:\Users\nathan\Desktop\GTA SA Mod & stuff\Servers\samp03x_svr_win32 (1)\gamemodes\CentralRp.pwn(11409) : error 029: invalid expression, assumed zero
C:\Users\nathan\Desktop\GTA SA Mod & stuff\Servers\samp03x_svr_win32 (1)\gamemodes\CentralRp.pwn(11409) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)