Only Admins Can Use This Command
#2

I'm gonna show you my /kick command. Maybe you'll understand something.
pawn Код:
if(strcmp(cmd, "/akick", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /akick [playerid/PartOfName] [reason]");
                return 1;
            }
            giveplayerid = ReturnUser(tmp);
                if (PlayerInfo[playerid][pAdministrator] >= 1) // This is the condition of being an admin.
            {
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        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: /akick [playerid/PartOfName] [reason]");
                            return 1;
                        }
                        Kick(playerid);
                    }
                }
            }
        }
    }
Reply


Messages In This Thread
Only Admins Can Use This Command - by SplinteX - 14.12.2013, 17:31
Re: Only Admins Can Use This Command - by rappy93 - 14.12.2013, 17:36
Re: Only Admins Can Use This Command - by SilentSoul - 14.12.2013, 17:43
Re: Only Admins Can Use This Command - by StuartD - 14.12.2013, 17:44

Forum Jump:


Users browsing this thread: 2 Guest(s)