%s not working at all ?
#1

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

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

For integer values, try using %d.
Reply
#4

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

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?)
Reply
#6

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

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

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

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)