SA-MP Forums Archive
A doubt - 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: A doubt (/showthread.php?tid=434484)



A doubt - Face9000 - 02.05.2013

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>");



Re: A doubt - Pottus - 02.05.2013

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.


Re: A doubt - Face9000 - 02.05.2013

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))"...?


Re: A doubt - BigGroter - 02.05.2013

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


Re: A doubt - Face9000 - 02.05.2013

Ok thanks.


Re: A doubt - Pottus - 02.05.2013

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.


Re: A doubt - Face9000 - 02.05.2013

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?


Re: A doubt - Pottus - 02.05.2013

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


Re: A doubt - Face9000 - 02.05.2013

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


Re: A doubt - Pottus - 02.05.2013

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.