Little help on ban and kick command with sscanf
#1

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

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

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?
Reply
#4

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?
Reply
#5

You can make it using https://sampwiki.blast.hk/wiki/File_Functions.
Reply
#6

ah great, thanks
Reply
#7

Even better: https://sampforum.blast.hk/showthread.php?tid=223063
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)