/kick CMD problem
#1

I have two problems with this command that I made..

When I do /kick to a player's ID that isn't my own, it still kicks me from the server.

Also, when I do kick myself, it doesn't tell the reason of why the person was kicked and would just appear as..
"Administrator Noles2197 kicked Noles2197 for"

Help please!

pawn Код:
#include <zcmd>
#include <sscanf2>
pawn Код:
CMD:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
      new Name[MAX_PLAYER_NAME], KickMessage[128];
      new Name2[MAX_PLAYER_NAME], id, reason[128];
      GetPlayerName(playerid,Name, sizeof(Name));
      GetPlayerName(id,Name2, sizeof(Name2));
      if(sscanf(params,"u",playerid)) return SendClientMessage(playerid, COL_RED,"/kick ID reason");
      format(KickMessage, sizeof(KickMessage), "Administrator %s kicked %s for %s", Name, Name2, reason);
      SendClientMessageToAll(COL_WHITE, KickMessage);
      Kick(id);
    }
    return 1;
}
Reply
#2

pawn Код:
if(sscanf(params, "is[128]", id, reason[128])) return SendClientMessage(playerid, -1, "Usage: /kick [ID] [Reason]");
Reply
#3

Код:
CMD:kick(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] > 0)
    {
      new Name[MAX_PLAYER_NAME], KickMessage[128];
      new Name2[MAX_PLAYER_NAME], id, reason[128];
	  
      GetPlayerName(playerid,Name, sizeof(Name));
      GetPlayerName(id,Name2, sizeof(Name2));
	  
      if(sscanf(params,"ds[64]",id,reason)) return SendClientMessage(playerid, COL_RED,"/kick ID reason"); 
      format(KickMessage, sizeof(KickMessage), "Administrator %s kicked %s for %s", Name, Name2, reason);
      SendClientMessageToAll(COL_WHITE, KickMessage);
      Kick(id);
    }
    return 1;
}
Reply
#4

Thanks for helping me fix both of those problems, but there's still one more thing..

When I /kick another player, it kicks them from the server, but it doesn't say their name and it says my name for who's being kicked.
Reply
#5

Double post, sorry.
Reply
#6

Try this:

PHP код:
CMD:kick(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] > 0)
    {
        new 
Name[MAX_PLAYER_NAME], KickMessage[128];
        new 
Name2[MAX_PLAYER_NAME], idreason[128];
      
        if(
sscanf(params,"ds[64]",id,reason)) return SendClientMessage(playeridCOL_RED,"/kick ID reason"); 
      
        
GetPlayerName(playerid,Namesizeof(Name));
        
GetPlayerName(id,Name2sizeof(Name2));
      
        
format(KickMessagesizeof(KickMessage), "Administrator %s kicked %s for %s"NameName2reason);
        
SendClientMessageToAll(COL_WHITEKickMessage);
        
Kick(id);
    }
    return 
1;

Reply
#7

Thanks. Just one more question! I'm to /kick players the ID of players that aren't even connected. Can someone help me with making a line that will say, "Player isn't connected" when someone tries to kick an ID that isn't owned?
Reply
#8

Код:
if(IsPlayerConnected(id))
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)