Using integer to create text.
#1

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

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..
Reply
#3

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

Use
mysql_get_field("Banned",ban);

and what value is in table?
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)