23.06.2009, 23:43
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
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
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;
}
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;
}