Kick 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 problem (
/showthread.php?tid=345762)
Kick problem -
MechaTech - 26.05.2012
Everything is working but only 1 thing isn't, and i dont know how to fix this. Here is my kick command:
pawn Код:
CMD:kick(playerid,params[])
{
new id,reason[50];
if(PlayerInfo[playerid][pAdmin] < 2) return SendClientMessage(playerid,COLOR_RED,"[ERROR] You've to be an level 1 admin to use this command.");
else if(sscanf(params,"us[128]",id,reason)) return SendClientMessage(playerid,COLOR_GREY,"[SYNTAX] Usage: /kick [playerid] [Reason]");
else if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_RED,"[ERROR] That player isn't connected.");
else
{
new string[124];
new name[MAX_PLAYER_NAME];
new nname[MAX_PLAYER_NAME];
GetPlayerName(id,name,MAX_PLAYER_NAME);
GetPlayerName(playerid,nname,MAX_PLAYER_NAME);
format(string,sizeof(string),"[KICK] %s has been kicked by %s [Reason: %s]",name,nname,string);
SendClientMessageToAll(COLOR_RED,string);
Kick(id);
}
return 1;
}
If i kick someone, all the players will get the message: [KICK] %s has been kicked by %s [Reason: %s].
But it isn't showing the reason. He will give this: [KICK] test has been kicked by test [Reason: ].
Please help.
Re: Kick problem -
JaTochNietDan - 26.05.2012
Well what do you expect to happen when you input the reason as a blank string? Why not use the reason string you initialized earlier specifically for the kick reason? For example:
pawn Код:
format(string,sizeof(string),"[KICK] %s has been kicked by %s [Reason: %s]",name,nname,reason);
Doesn't that make more sense?
Re: Kick problem -
MechaTech - 26.05.2012
Owhhh...

Thanks.