SA-MP Forums Archive
[Help] help with DCMD_KICK - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Help] help with DCMD_KICK (/showthread.php?tid=203133)



[Help] help with DCMD_KICK - Emanuel_Rodriguez - 26.12.2010

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;
}



Re: [Help] help with DCMD_KICK - [L3th4l] - 26.12.2010

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


Re: [Help] help with DCMD_KICK - willsuckformoney - 26.12.2010

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);



Respuesta: [Help] help with DCMD_KICK - anonymousx - 26.12.2010

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!");
   }
}



Re: [Help] help with DCMD_KICK - Emanuel_Rodriguez - 26.12.2010

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