Kick CMD
#1

I got a problem with my Kick cmd
First everything works fine in command but it was for all levels
So I set it to be for level 2-5

So now level 0 1 2 can't use it
But levels 2-5 can't kick

When I type /kick [id] [reason] it only sent the client message but it doesn't kick

Код:
CMD:kick(playerid,params[])
{
    new str[128];
	new id;
    if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid,COLOR_RED,"Error:only admin can use this command");
	if(pInfo[playerid][Adminlevel] >= 2)
	if(sscanf(params,"us;",id,str))
	{
	    SendClientMessage(playerid,0xFF0000FF,"USAGE: /kick [ID] [REASON]");
	    return 1;
	}
	if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"Invalid ID");
	new string[128];
	new name[MAX_PLAYER_NAME];
	new nname[MAX_PLAYER_NAME];
	GetPlayerName(id,name,MAX_PLAYER_NAME);
	GetPlayerName(playerid,nname,MAX_PLAYER_NAME);
	format(string,sizeof(string),"You have been kicked by Admin %s for: %s",nname,str);
	SendClientMessage(id,COLOR_BLUE,string);
	format(string,sizeof(string),"You have kicked %s for: %s",name,str);
	SendClientMessage(playerid,COLOR_BLUE,string);
	format(string,sizeof(string),"Admin %s has Kicked out %s for: %s",nname,name,str);
	SendClientMessageToAll(COLOR_BLUE,string);
	return 1;
}
Reply
#2

Код:
CMD:kick(playerid,params[])
{
    new str[128], id;
    if(pInfo[playerid][Adminlevel] < 2) return SendClientMessage(playerid,COLOR_RED,"Error: Only admin can use this command");
    if(sscanf(params,"us;",id,str)) return SendClientMessage(playerid,0xFF0000FF,"USAGE: /kick [ID] [REASON]");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,0xFF0000FF,"Invalid ID");
    new string[128];
    new name[MAX_PLAYER_NAME];
    new nname[MAX_PLAYER_NAME];
    GetPlayerName(id,name,MAX_PLAYER_NAME);
    GetPlayerName(playerid,nname,MAX_PLAYER_NAME);
    format(string,sizeof(string),"You have been kicked by Admin %s for: %s",nname,str);
    SendClientMessage(id,COLOR_BLUE,string);
    format(string,sizeof(string),"You have kicked %s for: %s",name,str);
    SendClientMessage(playerid,COLOR_BLUE,string);
    format(string,sizeof(string),"Admin %s has Kicked out %s for: %s",nname,name,str);
    SendClientMessageToAll(COLOR_BLUE,string);
    Kick(id); //I added this for you for real player kick.
    return 1;
}
Removed if(pInfo[playerid][Adminlevel] >= 2).

By the way, you are using kick command without Kick(id); Lol
Reply
#3

remove this string
Код:
if(pInfo[playerid][Adminlevel] >= 2)
Reply
#4

Try This

PHP код:
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 SendClientMessage(playeridred"USAGE: /lkick [playerid] [reason]");
            new 
player1playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], string[128];
            
player1 strval(tmp);

             if(
IsPlayerConnected(player1) && player1 != INVALID_PLAYER_ID && player1 != playerid && (PlayerInfo[player1][Level] != ServerInfo[MaxAdminLevel]) ) {
                
GetPlayerName(player1playernamesizeof(playername));        GetPlayerName(playeridadminnamesizeof(adminname));
                
CMDMessageToAdmins(playerid,"KICK");
                if(
isnull(tmp2)) {
                    
format(string,sizeof(string),"%s has been kicked by Administrator %s [no reason given] ",playername,adminname); SendClientMessageToAll(grey,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]); SendClientMessageToAll(grey,string);
                    
SaveToFile("KickLog",string); print(string); return Kick(player1); }
            } else return 
SendClientMessage(playeridred"Player is not connected or is yourself or is the highest level admin");
        } else return 
SendClientMessage(playerid,red,"ERROR: You are not a high enough level to use this command");
    } else return 
SendClientMessage(playerid,red,"ERROR: You must be logged in to use this commands");

Reply
#5

Hi man its the same thing ....
It only sent the client messages but it doesn't kick the user
Reply
#6

Sorry for double post.

You need to add
Код:
Kick(id);
to your command. Check my first post again.
Reply
#7

Hi man it work thanks
Reply
#8

Ah yeah I forgot, but you don't need to put another string that say else of PlayerInfo[playeid] ecc. and you don't need to put PlayerInfo[playerid][logged] ecc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)