Originally Posted by RogueDrifter
That's not the point, changing the player's name will fuck the reading/saving up,
anyway i made this
PHP код:
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;
}
or here's a cmd i found in some old script and shifted it.
PHP код:
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;
}
|