[Help] help with DCMD_KICK
#1

OK, so i am trying to make it where this dcmd command, shows the reason. this script mainly came from another website, but i customized it a little. I do not get what is wrong with the 'reason' part, as it does not show up.

pawn Код:
dcmd_kick(playerid, params[])
{
    new id, reason[64];
    if(IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "dz", id, reason))
        {
            SendClientMessage(playerid, COLOR_ORANGE, "Usage: /kick [playerid] [reason]");
            return 1;
        }
        else if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "Invalid id");
        {
            SendClientMessage(id, COLOR_RED, "You have been kicked from the server %s!");
            Kick(id);
            SendClientMessage(playerid, COLOR_YELLOW, "Player kicked.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
        return 1;
    }
    return 1;
}
Reply
#2

pawn Код:
dcmd_kick(playerid, params[])
{
    new PID, Str[80];
    if(sscanf(params, "us[50]", PID, params)) return SendClientMessage(playerid, COLOR_RED, "Usage: /Kick < Player ID > < Reason >");
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "That user is not connected!");
    format(Str, sizeof(Str), "You have kicked: %d - reason: %s", PID, params);
    SendClientMessage(playerid, COLOR_RED, Str);
    Kick(PID);
    return 1;
}
A very simple one
Requires sscanf plugin
Reply
#3

Replace
pawn Код:
SendClientMessage(id, COLOR_RED, "You have been kicked from the server %s!");
With

pawn Код:
new str[128];
format(str,128,"You have been kicked from the server! Reason: %s!",reason);
SendClientMessage(playerid,COLOR_RED,str);
Reply
#4

pawn Код:
dcmd_kick(playerid, params[])
{
   new
         id,
         reason[64];
   if(isPlayerAdmin(playerid))
   {
      if (sscanf(params, "dz", id, reason)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /kick [playerid] [reason]");
      else if (!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Invalid id");
      SendClientMessage(id, COLOR_RED, "You have been kicked from the server %s!");
      SendClientMessage(playerid, COLOR_YELLOW, "Player kicked.");
      return Kick(id);
   }
   else
   {
      return SendClientMessage(playerid, COLOR_RED, "You are not an admin!");
   }
}
Reply
#5

Quote:
Originally Posted by willsuckformoney
Посмотреть сообщение
Replace
pawn Код:
SendClientMessage(id, COLOR_RED, "You have been kicked from the server %s!");
With

pawn Код:
new str[128];
format(str,128,"You have been kicked from the server! Reason: %s!",reason);
SendClientMessage(playerid,COLOR_RED,str);
Ok this worked, thanks again! I new i had to put a string somewhere! ahaha
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)