Binary Usage - 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: Binary Usage (
/showthread.php?tid=395948)
Binary Usage -
thefatshizms - 28.11.2012
Hello, i found this while browsing the tips and tricks topic
https://sampforum.blast.hk/showthread.php?tid=177523 , where and when can i use binary? What things can it be used for in a gamemode? Whats the benefits of using binary?
If you could please answer my questions i will be very thankful
Re: Binary Usage -
Vince - 28.11.2012
Store up to 32 booleans (true/false variables) in a single variables. Individual bits can be combined creating 4294967296 unique combinations. For example if you save diseases, you could have:
1: disease 1
2: disease 2
4: disease 3
8: disease 4
16: ...
32: ...
64: ...
If the value of the variable is 6, then the player has disease 2 and 3.
Re: Binary Usage -
thefatshizms - 28.11.2012
Ah ok, thanks.