SA-MP Forums Archive
Question about 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: Question about sscanf (/showthread.php?tid=363132)



Question about sscanf - LetsOWN[PL] - 26.07.2012

Heya folks.
Just a little question.

So, I am makin admin system for my Server, but I am stuck in one question.
I wanna do one command (for e.g. warn) which can warn all players on only one.
I mean, if I write
Код:
/warn Le reason
it will warn first player with name starting or inlcuding 'le' in.
But how can I do if I use this command:
Код:
/warn * reason
it will loop through all players and warn them? Actually, part with loop is understandable for me, only I dunno what specifier do I've to use in condition with sscanf..

Normally, it is
pawn Код:
if(sscanf(params, "us[255]", id, reason))
.. And u is only for id/part of nickname.. Somebody know solution?
Or I have to make one extra specifer to determinate if command has to execute for one or all players?

Sry about that question.. Imma just curious

Thx, Greetz,
LetsOWN



Re: Question about sscanf - ViniBorn - 26.07.2012

Try this
pawn Код:
if(!sscanf(params, "us[255]", id, reason))
    //For one player
else if(!sscanf(params, "s[255]", reason))
    //For all players



Re: Question about sscanf - playbox12 - 26.07.2012

Check if params contains an * as the first character if(params[0] = "*") else you do the sscanf thing use a loop to cycle through all players and warn them.


Re: Question about sscanf [SOLVED] - LetsOWN[PL] - 26.07.2012

Thank you very much

Greeetz,
LetsOWN