kick command does not show reason (SOLVED)
#1

I made a kick command with DCMD but for some reason the reason that I type in does not show up

here is the command

pawn Код:
dcmd_kick(playerid, params[])
{
  new id, reason[64], playername[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], kickstring1[128], kickstring2[128];
 
    GetPlayerName(id,playername,sizeof(playername));
    GetPlayerName(playerid,adminname,sizeof(adminname));
 
  format(kickstring1,sizeof(kickstring1),"You Have Been Kicked By Administrator %s[%i]",adminname, playerid);
  format(kickstring2, sizeof(kickstring2),"Administrator %s[%i] has kicked %s[%i] (REASON: %s)",adminname,playerid,playername,playerid,reason);
  if(IsPlayerAdmin(playerid))
  {
    if (sscanf(params, "dz", id, reason)) SendClientMessage(playerid, 0xF6F600F6, "Usage: \"/kick [playerid] [reason]\"");
    else if (!IsPlayerConnected(id)) SendClientMessage(playerid, 0xFF0000F6, "Invalid id");
    else
    {
      SendClientMessage(id, 0xFF0000F6, kickstring1);
      SendClientMessage(playerid, 0xFF0000F6, kickstring2);
      Kick(id);
    }
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000F6, "Admins only!");
  }
  return 1;
}
also is there a way to shorten it? It seems longer than the other kick commands I have seen.

EDIT:

New Fixed Version For Anyone Who Comes Upon This Same Problem
pawn Код:
dcmd_kick(playerid, params[])
{
  new id, reason[64], player[24], admin[24], kickstring1[128], kickstring2[128];
 
  if(IsPlayerAdmin(playerid))
  {
    if (sscanf(params, "dz", id, reason)) SendClientMessage(playerid, 0xF6F600F6, "Usage: \"/kick [playerid] [reason]\"");
    else if (!IsPlayerConnected(id)) SendClientMessage(playerid, 0xFF0000F6, "Invalid id");
   
    else
    {
        GetPlayerName(id,player,24);
        GetPlayerName(playerid,admin,24);

    format(kickstring1,128,"SERVER: You Have Been Kicked By Administrator %s[%i]",admin, playerid);
    format(kickstring2,128,"SERVER: Administrator %s[%i] has kicked %s[%i] (REASON: %s)",admin,playerid,player,id,reason);
   
    SendClientMessage(id, 0xFF0000F6, kickstring1);
    SendClientMessage(playerid, 0xFF0000F6, kickstring2);
    Kick(id);
    }
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000F6, "Only Admins Can Use This Command!");
  }
  return 1;
}
Reply
#2

add result to it then mate
Reply
#3

Quote:
Originally Posted by Shady91
add result to it then mate
what do you mean?
Reply
#4

erm do you have /slap cmd added and if so do you have reson or like when you ban you add reson dose your ban have it?
Reply
#5

Quote:
Originally Posted by Shady91
erm do you have /slap cmd added and if so do you have reson or like when you ban you add reson dose your ban have it?
no, I don't have either of those commands. This is the first one that I am scripting
Reply
#6

erm im pritty sure theres commands in gf script use bits from there make it how u want but that as a guide mate.
Reply
#7

I fixed it. All I had to do was move the string down near where the kick actually happens.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)