/kick CMD problem - 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)
+--- Thread: /kick CMD problem (
/showthread.php?tid=408377)
/kick CMD problem -
Noles2197 - 17.01.2013
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;
}
Re: /kick CMD problem -
Djole1337 - 17.01.2013
pawn Код:
if(sscanf(params, "is[128]", id, reason[128])) return SendClientMessage(playerid, -1, "Usage: /kick [ID] [Reason]");
Re: /kick CMD problem -
PaulDinam - 17.01.2013
Код:
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;
}
Re: /kick CMD problem -
Noles2197 - 17.01.2013
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.
Re: /kick CMD problem -
Noles2197 - 17.01.2013
Double post, sorry.
Re: /kick CMD problem -
Chenko - 17.01.2013
Try this:
PHP код:
CMD:kick(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] > 0)
{
new Name[MAX_PLAYER_NAME], KickMessage[128];
new Name2[MAX_PLAYER_NAME], id, reason[128];
if(sscanf(params,"ds[64]",id,reason)) return SendClientMessage(playerid, COL_RED,"/kick ID reason");
GetPlayerName(playerid,Name, sizeof(Name));
GetPlayerName(id,Name2, sizeof(Name2));
format(KickMessage, sizeof(KickMessage), "Administrator %s kicked %s for %s", Name, Name2, reason);
SendClientMessageToAll(COL_WHITE, KickMessage);
Kick(id);
}
return 1;
}
Re: /kick CMD problem -
Noles2197 - 17.01.2013
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?
Re: /kick CMD problem -
u3ber - 17.01.2013
Код:
if(IsPlayerConnected(id))