SA-MP Forums Archive
Need some help with bit array - 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: Need some help with bit array (/showthread.php?tid=275076)



Need some help with bit array - KoczkaHUN - 08.08.2011

I'd need an array with a size of 2048 * 500. I need only 0 or 1 in each cell.
How could I do it with bits?


Re: Need some help with bit array - CaHbKo - 08.08.2011

How about 'bool' tag? You can't have anything except 0 or 1 (false or true) using it.


Re: Need some help with bit array - KoczkaHUN - 08.08.2011

I buy you a beer for that. thanks


Re: Need some help with bit array - FireCat - 08.08.2011

Quote:
Originally Posted by KoczkaHUN
Посмотреть сообщение
I buy you a beer for that. thanks
Can I have one too?
Anyways why would you want 2048 * 500
In a 1 bit cell?


Re: Need some help with bit array - Babul - 08.08.2011

how does a boolean array, f.ex. this
Код:
new Bool:GotHouseKey[MAX_PLAYER][2048];
looks like? maybe something set to true/false for 500 players each? for 2048 houses/cars/permissions maybe?


Re: Need some help with bit array - KoczkaHUN - 08.08.2011

let's imagine a 6x4 grid:
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0

like if there is 6 players, and 4 property overall. the grid contains a marker.
for example, if player 3 has a key to car #2, the grid changes that way:
0 0 0 0 0 0
0 0 1 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0

I don't need anything apart from 0 and 1. I need one bit.
new var[6][4]; vs new bool:var[6][4]; :
the first one can be from 0 to 4294967295. it stores 32 bits. i need 1 bit.
the second one can be from 0 to 1. it stores 1 bit.

remember.. this is a 6x4 grid. imagine that on a 2048x500 grid. i need only 1 bit...