new NormalName[MAX_PLAYERS];
enum pInfo
{
pAdminDuty,
pAdminName[MAX_PLAYER_NAME]
}
new PlayerInfo[MAX_PLAYERS+1][pInfo];
// public OnPlayerConnect
NormalName[playerid] = GetPlayerNameEx(playerid);
CMD:setaname(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid, COLOR_GREY, "You are not an admin!");
if(PlayerInfo[playerid][pAdminDuty] != 0) return SendClientMessage(playerid, COLOR_GREY, "You must off duty to change your admin name!");
if(isnull(params)) return SendClientMessageEx(playerid, COLOR_WHITE, "{6347AA}[Error]:{FFFFFF} /setaname [name]");
new str[128];
format(PlayerInfo[playerid][pAdminName], 128, params);
format(str, sizeof(str), "%s has changed his admin name to %s.", GetPlayerNameEx(playerid), params);
ABroadCast(COLOR_YELLOW, str, 2);
return 1;
}
// ADMIN DUTY
CMD:aduty(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new id;
if(PlayerInfo[playerid][pAdmin] > 2 && PlayerInfo[playerid][pAdminDuty] == 0)
{
SetPlayerName(playerid, PlayerInfo[playerid][pAdminName]);
SendClientMessage(playerid, COLOR_WHITE, "You are now on admin duty.");
PlayerInfo[playerid][pAdminDuty] = 1;
//ADUTYText[playerid] = Create3DTextLabel("I'm on Admin Duty",0xCCCC00FF,30.0,40.0,50.0,40.0,0);
//Attach3DTextLabelToPlayer(ADUTYText[playerid], playerid, 0.0, 0.0, 0.4);
IsADUTY[id] = true;
SetPlayerHealth(playerid, 999999);
SetPlayerArmour(playerid, 999999);
}
else if(PlayerInfo[playerid][pAdmin] > 2 && PlayerInfo[playerid][pAdminDuty] != 0)
{
SetPlayerName(playerid, NormalName[playerid]);
SendClientMessage(playerid, COLOR_WHITE, "You are now off admin duty.");
//Delete3DTextLabel(ADUTYText[playerid]);
IsADUTY[id] = false;
SetPlayerHealth(playerid, 100);
SetPlayerArmour(playerid, 0);
PlayerInfo[playerid][pAdminDuty] = 0;
}
}
return 1;
}
new NormalName[MAX_PLAYERS];
new NormalName[MAX_PLAYER_NAME];
what is NormalName[playerid] = GetPlayerNameEx(playerid);
GetPlayerNameex? |
GetPlayerNameEx(playerid) {
new
sz_playerName[MAX_PLAYER_NAME],
i_pos;
GetPlayerName(playerid, sz_playerName, MAX_PLAYER_NAME);
while ((i_pos = strfind(sz_playerName, "_", false, i_pos)) != -1) sz_playerName[i_pos] = ' ';
return sz_playerName;
}
pawn Код:
|
That code is correct, and should work. Have you checked my response? That should fix it i'm pretty sure
![]() |
//OnPlayerConnect
NormalName[playerid] = GetPlayerNameEx(playerid);
NormalName[MAX_PLAYER_NAME][MAX_PLAYERS];
May i ask, don't you want to set their name to the real one with the "_", since it's their real name and it uses around the map i guess?
So shoulden't you just use normal GetPlayerName instead of your version? |