I dont understand this o_O - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: I dont understand this o_O (
/showthread.php?tid=85082)
I dont understand this o_O -
Dreftas - 05.07.2009
pawn Code:
GetPlayerWeaponData(playerid,i,weaponid,ammo);
format(string,sizeof(string),"Weapon - %d",i);
dini_IntSet(path,string,weaponid);
format(string,sizeof(string),"AmmoID - %d",i);
dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
This is from [FS] Weapons saving by Phyro.
Can someone explane me this line:
Code:
dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
What this does:
ammo == 65535 ? 0 : ammo);
I dont have experience with
? : etc.
Re: I dont understand this o_O -
Grim_ - 05.07.2009
Ask in that scripts thread.
Re: I dont understand this o_O -
Weirdosport - 05.07.2009
https://sampwiki.blast.hk/wiki/Control_Structures#.3F:
It's the same as writing:
if(ammo == 65535) value = 0;
else value = ammo;
Or code to that effect. It will store 0 if the ammo is 65535, or will store the value of ammo otherwise.