My Kick Script Bug - 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: My Kick Script Bug (
/showthread.php?tid=564327)
My Kick Script Bug -
dh240473 - 20.02.2015
Sorry im newbie

When I Just Make /kick Then It Will Kick The person are using id 0

Here Is the Code
COMMAND:kick(playerid,params[])
{
new id,n[MAX_PLAYER_NAME],on[MAX_PLAYER_NAME];
new tmp[256], Index, str[49];
tmp = strtok(params,Index), id = strval(tmp);
GetPlayerName(id,on,sizeof(on));
GetPlayerName(playerid,n,sizeof(n));
if(AccInfo[playerid][Admin] < 3) return SendClientMessage(playerid,LIGHT_RED,"You need to be level 3 to use this command!");
if(!strlen(params)) return SendClientMessage(playerid,GREY,"USAGE: /kick <ID> ");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");
format(str,sizeof(str),"%s has kicked %s",n,on);
SendClientMessageToAll(LIGHT_BLUE,str);
Kick(id);
return 1;
}
Re: My Kick Script Bug -
Abagail - 20.02.2015
Use sscanf. strok, and alike methods are super outdated.
See:
https://sampforum.blast.hk/showthread.php?tid=120356
Re: My Kick Script Bug -
dh240473 - 20.02.2015
Ok I Will Try It
Re: My Kick Script Bug -
dh240473 - 20.02.2015
Ok Thx