Help pl0x - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help pl0x (
/showthread.php?tid=249271)
Help pl0x - Unknown123 - 17.04.2011
Here is a fast command i made...
v
pawn Код:
COMMAND:kick(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) SendClientMessage(playerid, COLOR_ERROR, "You are not autorized to use this command.");
{
new targetid, reason[128], string[128];
if(sscanf(params, "ds[128]", targetid, reason)) return SendClientMessage(playerid, COLOR_ERROR, "USAGE: /kick (id) (option: reason)");
{
if(IsPlayerOnline(playerid))
{
format(string, sizeof(string), "%s(%d) has been {FF0000}kicked {FFFFFF}by an server admin. | Reason: %s", PlayerName(targetid), targetid, reason);
SendClientMessageToAll(COLOR_INFO, string);
Kick(targetid);
}
}
return 1;
}
}
How to make it like if you dont type any reason.. just "/kick 1" then the %s (reason) should be replaced with "No specific reason"
Re: Help pl0x -
JaTochNietDan - 17.04.2011
Just add it as an optional string in sscanf, for example:
pawn Код:
sscanf(params, "dS(No specific reason)[128]", targetid, reason);
Re: Help pl0x - Unknown123 - 17.04.2011
Thx