? and
: are
triadic or
ternary operators.
Clickety!
They're handy because you can use them in assignment (or pretty much any statement for that matter), for example:
PHP код:
new bool:a = false;
new b = ( a == false ) ? ( 3 ) : ( 2 );
b would be assigned
3, because
a is evaluated as
false, and it returns
3.
this could also be wrote out as:
PHP код:
new bool:a = false;
new b;
if( a == false )
{
b = 3;
}
else
{
b = 2;
}
The code you posted:
PHP код:
new a;
a = 1;
if(a == 1) : print("a == 1!") ? print("a == 0!");
Isn't correct, the correct way of writing it would be:
PHP код:
new a;
a = 1;
print( ( a == 1 ) ? ( "a == 1!" ) : ( "a == 0!") );
As for 0x1 in the return, yea it's a hexadecimal representation of the value 1. See more about hex & pawn here:
https://sampwiki.blast.hk/wiki/Hex