A doubt
#1

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

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

Quote:
Originally Posted by [uL]Pottus
View Post
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))"...?
Reply
#4

Use "s[and the size of the variable you declared above]".
eg. "s[128]iiiiii".
Reply
#5

Ok thanks.
Reply
#6

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

Quote:
Originally Posted by [uL]Pottus
View Post
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?
Reply
#8

It will fail, and will try use test as the next specifier.
Reply
#9

Quote:
Originally Posted by [uL]Pottus
View Post
It will fail.
Oh...
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)