SA-MP Forums Archive
Yes/No in format - 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: Yes/No in format (/showthread.php?tid=340417)



Yes/No in format - Jstylezzz - 07.05.2012

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!


Re: Yes/No in format - [MG]Dimi - 07.05.2012

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;
}



Re: Yes/No in format - Jstylezzz - 07.05.2012

Thanks man


Re: Yes/No in format - Disturn - 07.05.2012

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];



Re: Yes/No in format - Jstylezzz - 07.05.2012

Ok, I will keep this in mind


Re: Yes/No in format - Jstylezzz - 07.05.2012

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