Binary Usage
#1

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
Reply
#2

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.
Reply
#3

Ah ok, thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)