[help] /kick with reason
#5

i will unconfuse it for you
put the define line at the top of your script with the variables
goto OnPlayerCommandText
type in
pawn Код:
dcmd(kick, 4, cmdtext); //command name without '/', length of command, and cmdtext(in case you renamed cmdtext to something else, you would change that)
than goto the bottom of your script and make a function called, and with the paramaters of
pawn Код:
dcmd_kick(playerid, params[])
now about sscanf, this can be used in many places, not just in cmds, but i will teach you for commands.(put sscanf in your script)
the usage is like this
pawn Код:
sscanf(params, "us", pid, reason) //u is a userid or name, s is a string, z is optional string
so you could do it in an if like this
pawn Код:
if (sscanf(params, "us", pid, reason)) SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid] [reason]");
so i will convert your command so you can understand.


pawn Код:
dcmd_kick(playerid, params[])
{
new pid, reason;
if (sscanf(params, "us", pid, reason)) return SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /kick [playerid] [reason]
if(Level[playerid] == 0) return 0;

new pname1[MAX_PLAYER_NAME], pname2[MAX_PLAYER_NAME] string[128];
GetPlayerName(playerid, pname1, 24);
GetPlayerName(pid, pname2, 24);

format(string, sizeof(string), "
**KICK [ADMIN KICK] %s Has Been Kicked From The Server By Admin %s Reason:%s.", pname2, pname1, reason);
SendClientMessageToAll(pink, string);

Kick(pid);
return 1;
this could be easily be converted so reason is optional, and almost as easy to make it not say Reason: than nothing here

hope i could help

Reply


Messages In This Thread
[help] /kick with reason - by StrickenKid - 24.02.2009, 13:42
Re: [help] /kick with reason - by StrickenKid - 24.02.2009, 13:58
Re: [help] /kick with reason - by Finn - 24.02.2009, 14:01
Re: [help] /kick with reason - by StrickenKid - 24.02.2009, 14:29
Re: [help] /kick with reason - by Daren_Jacobson - 24.02.2009, 14:50
Re: [help] /kick with reason - by StrickenKid - 24.02.2009, 21:30
Re: [help] /kick with reason - by Daren_Jacobson - 26.02.2009, 16:08

Forum Jump:


Users browsing this thread: 2 Guest(s)