bits return slot - 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: bits return slot (
/showthread.php?tid=398391)
bits return slot -
Night Dreamer - 09.12.2012
I have
PHP код:
new bitsvaribile[MAX_PLAYERS];
enum E_bitsSlot
{
fristSlotIsThis = 1,
theRestOfThem,
...
utilTheLastOne
};
#define BitCheck(%1,%2) ( ( bitsvaribile[%1] ) & ( 1 << %2 ) )
so with that I can return true or false... but insted of that I wana to return the %2 that is slot from the enum...
AW: bits return slot -
Nero_3D - 09.12.2012
Why do you want to return %2 if you already know it
pawn Код:
if(BitCheck(playerid, fristSlotIsThis)) {}
So this should return
fristSlotIsThis ?
Re: bits return slot -
Night Dreamer - 09.12.2012
nice try but I wana new one
PHP код:
if(BitCheckSlot(playerid) == fristSlotIsThis)
AW: bits return slot -
Nero_3D - 09.12.2012
That would only work if you only set one bit at once but I dont think that this is what you want
The easiest method would be a loop through all bits but there are some other methods like this
http://forum.sa-mp.com/showpost.php?...postcount=2683
This function returns the bit position (0 - 31)