#3

In my server there are 4 bots, ID 0, 1, 2 and 3
and i need to add that protection in this command

pawn Код:
CMD:kick(playerid,params[]) {
    if(PlayerInfo[playerid][LoggedIn] == 1) {
        if(PlayerInfo[playerid][Level] >= 4) {
            new tmp[128], tmp2[128], Index;     tmp = strtok(params,Index), tmp2 = strtok(params,Index);
            if(isnull(params)) return SendMessageToPlayer(playerid,COLOR_RED, "USAGE: /kick [playerid] [reason]");
            new player1, playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            player1 = strval(tmp);
            new playname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playname, sizeof(playname));
            if(IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
                GetPlayerName(player1, playername, sizeof(playername));     GetPlayerName(playerid, adminname, sizeof(adminname));
                CMDMessageToAdmins(playerid,"KICK");
                if(isnull(tmp2)) {
                    format(string,sizeof(string),"%s has been kicked by Administrator %s [no reason given] ",playername,adminname); SendMessageToAll(COLOR_BRIGHTRED,string);
                    SaveToFile("KickLog",string); print(string);
                    return Kick(player1);
                } else {
                    format(string,sizeof(string),"%s has been kicked by Administrator %s [reason: %s] ",playername,adminname,params[2]); SendMessageToAll(COLOR_BRIGHTRED,string);
                    SaveToFile("KickLog",string); print(string);
                    return Kick(player1);}
            } else return SendMessageToPlayer(playerid,COLOR_RED, "Player is not connected or is yourself or is the highest level admin");
        } else return SendMessageToPlayer(playerid, -1, "Error");
    } else return SendMessageToPlayer(playerid,COLOR_RED,"ERROR: You must be logged in to use this commands");}
Reply


Messages In This Thread
NPC - by P<3TS - 17.08.2012, 14:18
Re: NPC - by MicroD - 17.08.2012, 14:32
Re: NPC - by P<3TS - 18.08.2012, 09:30
Re: NPC - by P<3TS - 18.08.2012, 22:12
Re: NPC - by Kitten - 18.08.2012, 22:14
Re: NPC - by P<3TS - 18.08.2012, 22:42
Re: NPC - by Jstylezzz - 18.08.2012, 23:23
Re: NPC - by JaKe Elite - 18.08.2012, 23:47

Forum Jump:


Users browsing this thread: 5 Guest(s)