[HELP]sscanf with specifiers - 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: [HELP]sscanf with specifiers (
/showthread.php?tid=410061)
[HELP]sscanf with specifiers -
CoDeZ - 24.01.2013
Hello, i have a question, let's say i have the following line :
pawn Code:
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?
Re: [HELP]sscanf with specifiers -
Threshold - 24.01.2013
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 -____-*
Re: [HELP]sscanf with specifiers -
CoDeZ - 24.01.2013
Thanks, i can do that.
Re: [HELP]sscanf with specifiers -
CoDeZ - 24.01.2013
Quote:
Originally Posted by ******
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?