admin chat cmd help
#2

Just use IF statements. Try this:
pawn Код:
if(strcmp(cmd, "/admin", true) == 0 || strcmp(cmd, "/a", true) == 0)
  {
    if(IsPlayerConnected(playerid))
    {
     GetPlayerName(playerid, sendername, sizeof(sendername));
     new length = strlen(cmdtext);
     while ((idx < length) && (cmdtext[idx] <= ' '))
     {
      idx++;
     }
     new offset = idx;
     new result[64];
     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: (/a)dmin [admin chat]");
      return 1;
     }
     if (PlayerInfo[playerid][pAdmin] <= 2)
     {
      format(string, sizeof(string), "*%d Trial Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
      SendAdminMessage(COLOR_GREEN, string);
     }
     else if (PlayerInfo[playerid][pAdmin] >= 3 && <=9)
     {
      format(string, sizeof(string), "*%d Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
      SendAdminMessage(COLOR_GREEN, string);
     }
     else if (PlayerInfo[playerid][pAdmin] >= 10 && <=14)
     {
      format(string, sizeof(string), "*%d Head Admin %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
      SendAdminMessage(COLOR_GREEN, string);
     }
     else if (PlayerInfo[playerid][pAdmin] == 15)
     {
      format(string, sizeof(string), "*%d Server OWNER %s: %s", PlayerInfo[playerid][pAdmin], sendername, result);
      SendAdminMessage(COLOR_GREEN, string);
     }
     printf("Admin %s: %s", sendername, result);
   }
   return 1;
  }
Untested.
Reply


Messages In This Thread
admin chat cmd help - by WardenCS - 02.08.2009, 16:58
Re: admin chat cmd help - by member - 02.08.2009, 17:08
Re: admin chat cmd help - by Agent Smith - 02.08.2009, 17:10

Forum Jump:


Users browsing this thread: 1 Guest(s)