Need help understanding this...
#1

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

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))
Reply
#3

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
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)