kick command
#1

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
Reply
#2

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

Why would you use sizeof ?
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)