Instead of 1 or 0; how to make it say yes or no
#1

I want to know how to make something say yes or no instead of 1 or 0..

Please help?
Reply
#2

what you want to say can u please explain
Reply
#3

if(something == 1) somekindofstring = "Yes";
else if(something == 0) somekindofstring = "No";
Reply
#4

Quote:
Originally Posted by tyler12
Посмотреть сообщение
if(something == 1) somekindofstring = "Yes";
else if(something == 0) somekindofstring = "No";
Lolwut?

Can you explain more :/
Reply
#5

The only way is what tyler posted.
You set a variable to 0/1 and if it's 1, you set the string to 'yes', otherwise to 'no'. For example, on saving..
if he is registed (that means 1), then save it on the file as 'yes' (string) instead of 1. When you load, if the text is 'yes', set the variable to 1, otherwise 0.
Reply
#6

Quote:
Originally Posted by [MP]Ditch
Посмотреть сообщение
Lolwut?

Can you explain more :/
pawn Код:
new SomeIntger, YesOrNoString[24],string[124];; // The variable ( 1 / 0 ) and the YesOrNoString where Yes / No is stored

if(SomeIntger == 1) // If the variable is 1
{
YesOrNoString = "Yes"; // Set the YesOrNoString to Yes.
}
else if(SomeIntger == 0) // The variable is 0
{
YesOrNoString = "No"; // Set the YesOrNoString to No.
}

format(string,sizeof(string),"The answer is: %s",YesOrNoString); //We say Yes / No
Reply
#7

You can also do it this way

pawn Код:
new yourinteger = 1, yourstring[10];

format(yourstring, sizeof yourstring, "%s", yourinteger ? ("Yes") : ("No"));
print(yourstring); //Outputs "Yes"
http://forum.sa-mp.com/showpost.php?...7&postcount=73
Reply
#8

Quote:
Originally Posted by tyler12
Посмотреть сообщение
pawn Код:
new SomeIntger, YesOrNoString[24],string[124];; // The variable ( 1 / 0 ) and the YesOrNoString where Yes / No is stored

if(SomeIntger == 1) // If the variable is 1
{
YesOrNoString = "Yes"; // Set the YesOrNoString to Yes.
}
else if(SomeIntger == 0) // The variable is 0
{
YesOrNoString = "No"; // Set the YesOrNoString to No.
}

format(string,sizeof(string),"The answer is: %s",YesOrNoString); //We say Yes / No
So how would I do this for VIP in /stats?
Reply
#9

if(pInfo[playerid][VIP] == 1) return String = "Yes"
else if(pInfo[playerid][VIP] == 0) return String = "No"

Or you can do it the way iTorran said.
Reply
#10

Quote:
Originally Posted by [MP]Ditch
Посмотреть сообщение
So how would I do this for VIP in /stats?
pawn Код:
// /stats command

new
    Yes_No[ 5 ],
    string[ 128 ];
;

if( IsPlayerVip[ playerid ] ) format( Yes_No, 5, "Yes" );
else format( Yes_No, 5, "No" );

format( string, 128, "VIP: %s ...", Yes_No );
ShowPlayerDialog( ... ); or SendClientMessage( ... );
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)