PDA

View Full Version : [HELP]sscanf with specifiers


CoDeZ
24/01/2013, 06:48 AM
Hello, i have a question, let's say i have the following line :


if(sscanf(params,"us[10]",targetid,weapon))


How can i allow "weapon" to be entered as string or as an integer not only as a string or only as an integer?

Threshold
24/01/2013, 09:50 AM
Check if the string is numerical, if it is, then use strval to get a number from the string, if it is too high, invalid or too low to be a weapon, return an error. You just need the IsNumeric function, and then swap it to strval if it is numeric, or leave it as it is, if it's a string.

*JUST REALISED I HAD LEFT THIS WITHOUT PRESSING 'SUBMIT' FOR MORE THAN 2 HOURS -____-*

CoDeZ
24/01/2013, 11:33 AM
Thanks, i can do that.

CoDeZ
24/01/2013, 06:06 PM
Or use the "k<weapon>" specifier.

Ehm, how to use it, i looked before opening this thread, but found only k<playerstate> specifier,how to use the weapon one?
and how to forbid some weapon id?