04.01.2015, 09:59
Introduction
hi guys i know that some of you may think this is easy, but i saw some players made a question about this, so i'm here to help those who wanna make a Name tag ([Admin],[Donator], etc) for players(we do not really need Name tag for players) for admins, But remember: DO NOT COPY AND JUST PASTE the god, so lets start scripting or coding .
Scripting
So i don't know what you using or what your enum is.. but my enums are pDonators and pAdmin:
Код:
enum pInfo { pDonator, pAdmin } new PlayerInfo[MAX_PLAYERS][pInfo];
Remember: I don't know what you using for this thing, but im using Y_INI, and if you wanna use Y_INI, you gotta search for it.
---------------------------------------------------------------------------------------------------------------------------------------------- So lets proceed...
so lets stat with the Admins first:
Код:
public OnPlayerText(playerid, text[]) { if(PlayerInfo[playerid][pAdmin] >= 1) //pAdmin is my enum i don't know whats your enum, also number "1" indicates the level of the admin, i got 1-8 admin levels, you can choose what level are yours. { new string[150], name[MAX_PLAYER_NAME]; //Lets make a new string and a name.. GetPlayerName(playerid, name, MAX_PLAYER_NAME); // This is the name format(string,sizeof(string),"{993300}[ADMIN] {33CC99}%s {999999}[%i]: {FFFFFF}%s", name, playerid, text); //Make your format, you can change the colors... SendClientMessageToAll(GetPlayerColor(playerid), string); //SendClientMessageToAll so all can see your chat, "GetPlayerColor" doesn't work if put a color on his name, remove the color so he if he do /red ( if you have a command ) his name will be color red.. return 0; }
Код:
if(PlayerInfo[playerid][pDonator] >= 1) { new string[150], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string,sizeof(string),"{FF6600}[DONATOR] {990099}%s {999999}[%i]: {FFFFFF}%s", name, playerid, text); SendClientMessageToAll(GetPlayerColor(playerid), string); return 0; }
Код:
if(PlayerInfo[playerid][pAdmin] >= 0) //Recommended, also put this at the really bottom( i don't know why), just put in at the very bottom at the Playertext, this is the Chat of the Player we need GetPlayercolor here.. { new string[150], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string,sizeof(string),"%s {999999}[%i]: {FFFFFF}%s", name, playerid, text); SendClientMessageToAll(GetPlayerColor(playerid), string); return 0; } return 1; }
Full Code:
Код:
public OnPlayerText(playerid, text[]) { if(PlayerInfo[playerid][pAdmin] >= 1) { new string[150], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string,sizeof(string),"{993300}[ADMIN] {33CC99}%s {999999}[%i]: {FFFFFF}%s", name, playerid, text); SendClientMessageToAll(GetPlayerColor(playerid), string); return 0; } if(PlayerInfo[playerid][pDonator] >= 1) { new string[150], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string,sizeof(string),"{FF6600}[DONATOR] {990099}%s {999999}[%i]: {FFFFFF}%s", name, playerid, text); SendClientMessageToAll(GetPlayerColor(playerid), string); return 0; } if(PlayerInfo[playerid][pAdmin] >= 0) { new string[150], name[MAX_PLAYER_NAME]; GetPlayerName(playerid, name, MAX_PLAYER_NAME); format(string,sizeof(string),"%s {999999}[%i]: {FFFFFF}%s", name, playerid, text); SendClientMessageToAll(GetPlayerColor(playerid), string); return 0; } return 1; }