29.12.2017, 15:17
So i need help about AdminPrefixes. Can anyone help me?
new pName[24], str[MAX_PLAYER_NAME + 7];
GetPlayerName(id, pName, sizeof(pName));
format(str, sizeof(str), "[Admin]%s", pName);
SetPlayerName(id, str);
new adminchat[MAX_PLAYERS];
CMD:admchat(playerid,params[])
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,".: Unauthorized cmd! :.");
if(adminchat[playerid])
{
adminchat[playerid]=false;
SendClientMessage(playerid,-1,".: Admin chat off! :.");
}
else
{
adminchat[playerid]=true;
SendClientMessage(playerid,-1,".: Admin chat on! :.");
}
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
adminchat[playerid]=false;
return 1;
}
public OnPlayerText(playerid,text[])
{
if(adminchat[playerid])
{
new name[26],string[126];
GetPlayerName(playerid,name,sizeof(name));
format(string,sizeof(string),"[Admin]%s: {FFFFFF}%s",name,text);
SendClientMessageToAll(GetPlayerColor(playerid),string);
return 0;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/admchat", cmdtext, true, 10) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Unauthoerized cmd");
GetPlayerName(playerid, name, sizeof(name));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[200];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /admchat [admin chat]");
return 1;
}
format(string, sizeof(string), "[Admin]%s:{FFFFFF} %s ",name, result);
SendClientMessageToAll(GetPlayerColor(playerid),string);
return 1;
}
return 0;
}
That's not the point, changing the player's name will fuck the reading/saving up,
anyway i made this PHP код:
PHP код:
|