Need help understanding this... - 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: Need help understanding this... (
/showthread.php?tid=539948)
Need help understanding this... -
GunZ75 - 01.10.2014
HI guys im getting rly pissed off cause i cant understand this... Im trying to make the most simple thing EVER: kick command... cant make it cause i dont know how to indicate the target or make the params or any of that... CAn u guys explain me the best way so i understand? please!
Re: Need help understanding this... -
Sascha - 01.10.2014
I'd suggest you to use sscanf (
click here to get to the sscanf topic)
in addition (if you're not using it) I'd use zcmd personally (you can use whatever you want, though -
zcmd here)
with zcmd it would look like the following:
pawn Код:
CMD:kick(playerid, params[])
{
new pid;
if(!sscanf(params, "i", pid))
{
Kick(pid);
}
else
{
SendClientMessage(playerid, 0x999999AA, "useage: /kick [playerid]");
}
return 1;
}
(just example code, you should add more specifications to this command (like admin, etc. you know))
Re: Need help understanding this... -
Rudy_ - 01.10.2014
pawn Код:
CMD:kick(playerid, params[]) //The command, playerid is the player who typed the cmd and params is the string entered after the command
{
new pid; //A new variable called pid
if(!sscanf(params, "i", pid)) //using sscanf, if params (checking parameters, "i" (the player id who you want to kick) "pid" the variable (id of the player u want to kick)
{
Kick(pid); // Kick (the player (id))
}
else //if you didn't entered any string after the command e,g /kick [string or id) then
{
SendClientMessage(playerid, 0x999999AA, "usage: /kick [playerid]"); //send a message saying use kick [playerid]
}
return 1; //Stops the script after everything is executed, 1 is true 0 is false
}