SA-MP Forums Archive
i have no idea what to call this... - 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: i have no idea what to call this... (/showthread.php?tid=464712)



i have no idea what to call this... - sansk - 18.09.2013

I was watching a tutorial on how to make a Vehicle system.. and it was supposed to save if the vehicle was locked..
First of all i did not understand this line:
Код:
VehicleInfo[vehicleID][vLocked] = INI_Int("locked") == 1 ? true : false;
and second of all.. It didn't work. it was supposed to convert an integer to a boolean..
Any ideas ?


There was only one error though:

Код:
C:\Users\Sander\Desktop\RGRP\gamemodes\PCRP.pwn(1698) : error 017: undefined symbol "INI_Int"



Re: i have no idea what to call this... - Konstantinos - 18.09.2013

It's called ternary operator. Although, the way it's used in the code above is confused.

Basically, it goes like that.

pawn Код:
// An example:
new
    bool: a,
    b = 10
;
a = ( b == 10 ) ? true : false;
In a way you can understand:
pawn Код:
if( b == 10 ) a = true;
else a = false;



Re: i have no idea what to call this... - [FSaF]Jarno - 18.09.2013

"VehicleInfo[vehicleID][vLocked] = INI_Int("locked")"
This means the "vLocked" attribute will be set to the INI file's "locked" state.
"== 1 ? true" means (if INI_Int("locked") is 1 then set vLocked to true)
": false" means "else set vLocked to false"
For the error, make sure you add #include <YSI/y_ini> to the top of your script.

Hope you understood


Re: i have no idea what to call this... - sansk - 18.09.2013

The problem is that i have made a register/login system with Y_INI and i use it in alot of other lines.. but that is the only error i have and it is from that confusing line


Re: i have no idea what to call this... - Dragonsaurus - 18.09.2013

pawn Код:
#include <YSI\y_ini>     // At the top of your script
And make sure you have downloaded YSI and placed in pawo/include folder.


Re: i have no idea what to call this... - sansk - 18.09.2013

I deleted the whole thing cuz nobody understands that i have downloaded it, and i am using it.. and i have included it at the top of the script.. join 198.20.110.137:7777 and you can see that my login/register system works fine..