Admin Prefixes Help
#9

Quote:
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(playeridcmdtext[])
{
    if (
strcmp("/admchat"cmdtexttrue10) == 0)
    {
        if(!
IsPlayerAdmin(playerid)) return SendClientMessage(playerid,-1,"Unauthoerized cmd");
        
GetPlayerName(playeridnamesizeof(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(playeridCOLOR_GRAD2"USAGE: /admchat [admin chat]");
            return 
1;
            }
        
format(stringsizeof(string), "[Admin]%s:{FFFFFF} %s ",nameresult);
          
SendClientMessageToAll(GetPlayerColor(playerid),string);
        return 
1;
        }
return 
0;

Where did I said you need to change the player's name?
You just got to compare if he's on duty then add a [Admin] tag before his name, send his msg and return 0 so that server doesn't do it since we're sending the msg manually.
Reply


Messages In This Thread
Admin Prefixes Help - by CeciiBG - 29.12.2017, 15:17
Re: Admin Prefixes Help - by JaKe Elite - 29.12.2017, 20:53
Re: Admin Prefixes Help - by CeciiBG - 30.12.2017, 11:12
Re: Admin Prefixes Help - by JaKe Elite - 30.12.2017, 11:25
Re: Admin Prefixes Help - by RogueDrifter - 30.12.2017, 11:45
Re: Admin Prefixes Help - by Ritzy2K - 30.12.2017, 12:27
Re: Admin Prefixes Help - by RogueDrifter - 30.12.2017, 13:07
Re: Admin Prefixes Help - by CeciiBG - 30.12.2017, 13:47
Re: Admin Prefixes Help - by Ritzy2K - 30.12.2017, 16:36
Re: Admin Prefixes Help - by RogueDrifter - 31.12.2017, 07:01

Forum Jump:


Users browsing this thread: 2 Guest(s)