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



/kick ? - Calinut200 - 15.11.2018

What i do wrong? Is my first command like that.
PHP код:
CMD:kick(playeridparams[])
{
    new 
idstring[256],player[MAX_PLAYER_NAME],user[MAX_PLAYER_NAME];
    
GetPlayerName(idplayersizeof(player));
    
GetPlayerName(playeridusersizeof(user));
    if(
sscanf(params,"u"id)) return SendClientMessage(playerid,-1,"INFO:Foloseste /kick [NAME/ID]");
    if(!
IsPlayerConnected(id))  return SendClientMessage(playerid,-1,"Player is not connected.");
    
format(string,sizeof(string), "INFO: %s a primit kick de la Adminul %s ",player,user);
    
SendClientMessageToAll(-1,string);
    return 
1;




Re: /kick ? - d1git - 15.11.2018

You're using GetPlayerName before sscanf assigns the id variable, that's why you're getting player id 0 everytime you run the command.

PHP код:
new
    
id,
    
player[MAX_PLAYER_NAME]
;
if (
sscanf(params"u"id)) return SendClientMessage(playerid, -1"INFO:Foloseste /kick [NAME/ID]");
GetPlayerName(idplayersizeof player);