Yes/No in format
#1

Hello everyone!

I am making a /stats command, but i am stuck here :\

I want to display if the player has a mask yes or no, and that when the variable is 1, it shows yes, and when the variable is 0 it shows no..

I know solution, but my way it will be very messy and big, so i hope someone can help me with this.

Example:

pawn Код:
format(stats2,sizeof(stats2),"Mask: "// idk how to make this display yes/no

if(GetPVarInt(playerid,"Mask") == 1) //display Yes in the message
if(GetPVarInt(playerid,"Mask") == 1) //display No  in the message
Thanks in advance!
Reply
#2

Since I use it in a lot of places in script I created stock that will return Yes/No Answer.

pawn Код:
stock GetYesNoAnswer(value)
{
    new answer[3];
    if(!value) answer = "No";
    else answer = "Yes";
    return answer;
}
Reply
#3

Thanks man
Reply
#4

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Since I use it in a lot of places in script I created stock that will return Yes/No Answer.

pawn Код:
stock GetYesNoAnswer(value)
{
    new answer[3];
    if(!value) answer = "No";
    else answer = "Yes";
    return answer;
}
Remember, a char array also contains a null character '\0' which signifies the end of the sequence within the list of elements of the array.
new answer[3];

Код:
[Y][E][S][\0]
[0][1][2][3]
pawn Код:
new answer[4];
Reply
#5

Ok, I will keep this in mind
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
A post I wrote recently on this exact question:

http://forum.sa-mp.com/showthread.ph...57#post1795557
Sorry, I've had to look better..
Thanks for this post, i will use this also
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)