1) You can do something like this to get player name and add [Admin] to the front of it.
pawn Код:
if(PlayerInfo[playerid][pAdmin] >= 1) //Change to your admin variable
{
new pname[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "[Admin] %s", pname);
SetPlayerName(playerid, string);
}
This simply states you create two variables, string and pname. pname receives the players name, then formats it into a string after the [Admin] name in front of it. Then it simply sets the name to the string.
Untested, but it's worth a shot.
Not quite sure how to do the second thing.
You could try to use strfind.
pawn Код:
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
if(strfind(pname, "[Admin]", true) != -1)
{
if(!PlayerInfo[playerid][pAdmin] >= 1) //Again,change to your admin variable
{
Kick(playerid);
SendClientMessage(playerid, -1, "Please remove the [Admin] in your name, as you are not an admin");
return 1;
}
}
Never used something like this but if not correct, this would check the pname for [Admin] in it and would return with a kick and a sendclientmessage if he isn't an admin. If he is, it would continue.
EDIT: Beat me to it, Realcop T.T