SA-MP Forums Archive
%s not working at all ? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: %s not working at all ? (/showthread.php?tid=155771)



%s not working at all ? - oliverrud - 19.06.2010

Hey so yea I've now tried 50000 times to get %s working at any of my places where I need it with no luck, like an example: I got a bank status page.

format(string2,300,"Bank Name: %s\nAmount: %d\nTransfer ID: %d",strval(field[1]),strval(field[3]),strval(field[0]));
It shows Amount, Transfer ID, but not Bank Name because it uses %s and if I'm right then only %s works if you want text and not numbers to appear? My mysql tables is: VarChar(256) at Bank Name


Re: %s not working at all ? - Antonio [G-RP] - 19.06.2010

Thts because, youur using 'strval' which is for VARIABLES (numbers) only... for %s you must used a string.


Re: %s not working at all ? - DJDhan - 19.06.2010

For integer values, try using %d.


Re: %s not working at all ? - oliverrud - 19.06.2010

Well how to output text then if %s wont work? Any solution?


Re: %s not working at all ? - Antonio [G-RP] - 19.06.2010

Quote:
Originally Posted by DJDhan
For integer values, try using %d.
or %i

Anyways, you must define the bank name in a string but I saw that its reading from field... you running SQL?

Just remember floatstr is for floats, strval is for intergers, ****** is for text? (What goes there?)


Re: %s not working at all ? - oliverrud - 19.06.2010

Quote:
Originally Posted by ♂ Antonio [G-RP
]
Quote:
Originally Posted by DJDhan
For integer values, try using %d.
or %i

Anyways, you must define the bank name in a string but I saw that its reading from field... you running SQL?

Just remember floatstr is for floats, strval is for intergers, ****** is for text? (What goes there?)
I got no problem with the numeric parts of my script, Yes I'm running from SQL, All I'm trying to do is just to make the BankName show under my bank status page, since %s wont work what is there then? Is there even a %'something' that can output text?


Re: %s not working at all ? - DJDhan - 19.06.2010

If you want to display strings,don't use "strval".


Re: %s not working at all ? - oliverrud - 19.06.2010

Quote:
Originally Posted by DJDhan
If you want to display strings,don't use "strval".
What should I then use? Instead of strval?


Re: %s not working at all ? - dcmd_crash - 19.06.2010

pawn Код:
format(string2,300,"Bank Name: %s\nAmount: %d\nTransfer ID: %d",field[1],strval(field[3]),strval(field[0]));
Try that, brother.


Re: %s not working at all ? - oliverrud - 19.06.2010

Quote:
Originally Posted by _❼_
pawn Код:
format(string2,300,"Bank Name: %s\nAmount: %d\nTransfer ID: %d",field[1],strval(field[3]),strval(field[0]));
Try that, brother.
Thanks Made my day!