Question about sscanf
#1

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

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

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

Thank you very much

Greeetz,
LetsOWN
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)