Bool
Argh, I've been coding for a while, and took a huge break.
The thing is, I never learned what bool is or how to use it. I read a short 2 setence explaination on what they are, they hold an option of true or false. Ok. Now I have a few questions regarding boolean variables. 1) How do I get the state of the bool variable? Example: new bool:coords[3] From my understanding, it is false my default. Now, how would I go about seeing what the state of it is anyhow, in an "IF()" statement? This is what I've tried Code:
2) What is the variable to use in a client_print() function to echo the state of the bool? Example: client_print(id,print_chat,"State: %s",bool:coords) I need to know what symbol (%s, %i, etc). Thanks. |
A bool is similar to a float in that you only have to declare bool: when you create it.
When you use it in a if() its: Code:
I believe a bool is an interger, but I am not sure. |
ok, but I'm using it as an array.
|
Then it would be
Code:
And a wya you can check the value of the bool is: Code:
|
1 Attachment(s)
Quote:
This image below, makes me think that I am doing the true/false wrong in the IF() statements for the bools. Right? Wrong? |
A bool is NOT an integer. A bool is a boolean value; true or false, 1 or 0.
You also need to use a strong tag: Bool: if you want to use it like that, otherwise you'll get tag warnings. Its only similarity to a float is that, in PAWN, it is the size of one cell, and it is declared using a tag. |
Quote:
|
Yeah.
|
In pawn:
In IF statement you can do Code:
Code:
In print you can do Code:
|
Quote:
Code:
|
| All times are GMT -4. The time now is 20:21. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.