Little help on ban and kick command with sscanf - 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: Little help on ban and kick command with sscanf (
/showthread.php?tid=461130)
Little help on ban and kick command with sscanf -
knackworst - 31.08.2013
Hello again
again another thread, I hope I haven't exceeded a limit yet...
Anyways
I am making my admin system, and I'm doing very good, however I'm stuck at the kick and ban command (and pretty much all commands where the admin has to give a reason for the command)
So for example for this setlevel command:
pawn Код:
if(sscanf(params,"ui",id,level)) return SendClientMessage(playerid,-1,"Use: /setlevel <id> <level>");
I just use params "ui", id, level.
But if the admin has to give a reason how do I make one of the params a string?
so I can do this:
pawn Код:
if(sscanf(params,"us",id,reason)) return SendClientMessage(playerid,-1,"Use: /ban <id> <reason>");
Any help?
Thanks in advance
Re: Little help on ban and kick command with sscanf -
Dragonsaurus - 31.08.2013
Yeah, but you should add the size of the reason string, otherwise you will get a bunch of errors:
pawn Код:
if(sscanf(params,"us[128]",id,reason)) return SendClientMessage(playerid,-1,"Use: /ban <id> <reason>");
Re: Little help on ban and kick command with sscanf -
RedJohn - 31.08.2013
You use
s specifier for strings.
Example:
pawn Код:
new id, reason[128];
if(sscanf(params,"us[128]", id, reason)) return SendClientMessage(playerid,-1,"Use: /ban <id> <reason>");
Is this what you want?
Re: Little help on ban and kick command with sscanf -
knackworst - 31.08.2013
Yep, thanks man
and maybe to avoid making another thread, do you maybe know how I can easly write those strings to a log in the scriptfiles? so I can make a kick/banlog?
Re: Little help on ban and kick command with sscanf -
RedJohn - 31.08.2013
You can make it using
https://sampwiki.blast.hk/wiki/File_Functions.
Re: Little help on ban and kick command with sscanf -
knackworst - 31.08.2013
ah great, thanks
Re: Little help on ban and kick command with sscanf -
RedJohn - 31.08.2013
Even better:
https://sampforum.blast.hk/showthread.php?tid=223063