Posts: 3,351
Threads: 780
Joined: Jan 2010
Im making an event system, i wanna know if this parameters "ddiiii" are correct for the values assigned:
pawn Code:
if(sscanf(params,"ddiiii",event,team,wep1,wep2,hp,arm)) return SCM(playerid,0xff0000FF,"{F70505}Usage: {FFFFFF}/event <event name> <team id> <weapon 1> <weapon 2> <health> <armour>");
Posts: 4,885
Threads: 57
Joined: Jun 2012
Reputation:
0
The event name is a string right? you want if(sscanf(params,"siiiiii",event,team,wep1,wep2,hp ,arm)) also the specifiers "i" and "d" are the same so choose one or the other.
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by [uL]Pottus
The event name is a string right? you want if(sscanf(params,"siiiiii",event,team,wep1,wep2,hp ,arm)) also the specifiers "i" and "d" are the same so choose one or the other.
|
Yes, a string. So i should use "if(sscanf(params,"siiiiii",event,team,wep1,wep2,h p,arm))"...?
Posts: 288
Threads: 42
Joined: Jun 2009
Reputation:
0
Use "s[and the size of the variable you declared above]".
eg. "s[128]iiiiii".
Posts: 3,351
Threads: 780
Joined: Jan 2010
Posts: 4,885
Threads: 57
Joined: Jun 2012
Reputation:
0
Just make sure you have no spaces in the event name, if you want spaces I would recommend using y_inline / y_dialog for entering the name. I always forget about specifying the array size heh.
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by [uL]Pottus
Just make sure you have no spaces in the event name, if you want spaces I would recommend using y_inline / y_dialog for entering the name.
|
What if i do "Even Test" instead of "EventTest"...? What will change?
Posts: 4,885
Threads: 57
Joined: Jun 2012
Reputation:
0
It will fail, and will try use test as the next specifier.
Posts: 3,351
Threads: 780
Joined: Jan 2010
Quote:
Originally Posted by [uL]Pottus
It will fail.
|
Oh...
Posts: 4,885
Threads: 57
Joined: Jun 2012
Reputation:
0
I'm guessing this is a limitation of sscanf() maybe Y_Less has a way to do it? One other idea is you could make your own custom specifier to handle doing it but your probably better off just using y_inline / y_dialog.