/a(adminchat) problem
#1

I want to make an adminchat, but i can't get it finished, i want to send the client message to all admins but i don't have an idea to do that.

Im so far:

pawn Код:
if(strcmp(cmd, "/a", true) == 0)
        {
        if(pInfo[playerid][Admin] >= 0)
        {
        tmp = strtok(cmdtext,idx), tmp2 = strtok(cmdtext,idx);
        new player1, level;
            player1 = strval(tmp);
            level = strval(tmp2);
         if(!strlen(tmp))
         {
             SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /a [text]");
         }
         else
         {
                GetPlayerName(player1, playername, sizeof(playername));   GetPlayerName(playerid, adminname, sizeof(adminname));
                format(string,sizeof(string),"Adminchat (%s): %s", playername, tmp);
                SendClientMessage(playerid, purple, string);
                }
         }
         return 1;
}
Reply
#2

1) You're checking if the player's admin level is equal to or over ZERO (0)
2) You aren't sending message to anybody but yourself
3) You're getting the name of player1 for some reason
4) You have a variable called player1 and level for some reason
5) Holy crap this is so wrong

Sorry, but you need to read EVERYTHING in https://sampwiki.blast.hk/

pawn Код:
if(strcmp(cmd, "/a", true) == 0)
    {
        if(pInfo[playerid][Admin] < 1) return 0;
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_YELLOW, "USAGE: /a [text]");
        GetPlayerName(playerid, adminname, sizeof(adminname));
        for(new i,ii = GetMaxPlayers(); i < ii; i++)
        {
            if(IsPlayerConnected(i))
            {
                if(pInfo[i][Admin] >= 1)
                {
                    format(string,sizeof(string),"Adminchat (%s): %s", playername, tmp);
                    SendClientMessage(i, purple, string);
                }
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)