Using integer to create text. - 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: Using integer to create text. (
/showthread.php?tid=310563)
Using integer to create text. -
Richie - 12.01.2012
I was wondering how i can use an interger to create a text like:
var[banned] = 1, so i want to use this to create a string "Banned: %s", but not 0 or 1, but 'No' or 'Yes'. Or 'IP' or 'Account'.
How to?
Re: Using integer to create text. -
Fj0rtizFredde - 12.01.2012
You could do something like this: (May not be the best way
)
pawn Код:
new Text[5];
if(var[banned] == 1) Text = "Yes";
else Text = "No";
printf("%s",Text); //Or use format etc..
Re: Using integer to create text. -
Richie - 12.01.2012
im doing it like this, it show Banned: No, but also on players that are actually banned.
pawn Код:
mysql_fetch_field_row(ban, "Banned");
new BanInfo = strval(ban);
new bantext[15];
if(BanInfo == 1) bantext = "{EF1717}Yes";
else bantext = "No";
what did i do wrong?
Re: Using integer to create text. -
Jefff - 12.01.2012
Use
mysql_get_field("Banned",ban);
and what value is in table?
Re: Using integer to create text. -
Richie - 12.01.2012
In the db Banned is an integer, 0 = not banned, 1 = banned.
I wanted to put this in offline check command, cuz it looks better with 'Yes'/'No', instead of 0/1.
Edit: i didnt look up 5cm to add 'Banned' in SELECT query :S Thanks for help, now its working.