SA-MP Forums Archive
kick command - 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 command (/showthread.php?tid=656952)



kick command - Heress - 28.07.2018

I created /kick command, but when I kick player In message to all players been writed what I kicked myself, but I kicked another player: https://imgur.com/a/0hoj0qi

Code:
Quote:

CMD:kick(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid, RAUDONA, "KLAIDA: {559ABD}Tik Kūrėjų Komanda gali naudoti љią komandą!");
new userid, reason[128], string[128];
new Playername[MAX_PLAYER_NAME], Adminname[MAX_PLAYER_NAME];
GetPlayerName(playerid, Adminname, sizeof(Adminname));
GetPlayerName(userid, Playername, sizeof(Playername));
if (sscanf(params, "us[64]", userid, reason))return SendClientMessage(playerid, MELYNA, "Naudojimas: /kick [ID] [Prieћastis]");
if(!IsPlayerConnected(userid))return SendClientMessage(playerid, RAUDONA, "Tokio ћaidėjo nėra!");
format(string, sizeof(string), "[KICK] Administratorius %s iљmetė %s iљ serverio. (Prieћastis: %s)", Adminname, Playername, reason);
SendClientMessageToAll(GELTONA, string);
Kick(userid);
return 1;
}

Pastebin https://pastebin.com/TAWE4C9p


Re: kick command - SyS - 28.07.2018

GetPlayerName(userid, Playername, sizeof(Playername)); should be called after sscanf statement otherwise userid is 0


Re: kick command - Hunud - 28.07.2018

Why would you use sizeof ?


Re: kick command - Heress - 28.07.2018

Quote:
Originally Posted by SyS
Посмотреть сообщение
GetPlayerName(userid, Playername, sizeof(Playername)); should be called after sscanf statement otherwise userid is 0
Thanks +rep