SA-MP Forums Archive
What is bool vs 32 bit new? - 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: What is bool vs 32 bit new? (/showthread.php?tid=93943)



What is bool vs 32 bit new? - RSX - 27.08.2009

Ok, I for long time didn't use bool (i didn't really know what it is) and, so i remember, that i have saw in keys using about like this:
if(keys&KEY_WHATEVER)
So by having each key other number 2*2 (i don't know how it spells in english, maybe power) it allows to have 2 or more keys pressed working in time.
Last i want to say is that bool is 7 bit in ram, new is 32 bit, bool limits are 1 or 0, new limits are 2147483647, bool is faster but, can hold one 0 or 1,
new is slower, but can hold 31 0 or 1, so it's in right using is like 31 bool variables.
Here you can see my fast cmd that shows the usement of this:
new cmd[256];
new idx;
new tmp[256];
cmd = strtok(cmdtext, idx);
if (strcmp(cmd, "/NT", true) ==0)
{
tmp=strtok(cmdtext, idx);
new thevar=strval(tmp);
new trs[128];
format(trs,128,"Binary : %b", thevar);
SendClientMessage(playerid,0xFFFFFFFF,trs);
new multi2=1;
for(new k;k<31;k++)
{
if(thevar&multi2)
{
format(trs,128,"Bit Offset : %d, Decimal Offset : %d, IS 1", k, multi2);
SendClientMessage(playerid,0xFFFFFFFF,trs);
}
else
{
format(trs,128,"Bit Offset : %d, Decimal Offset : %d, IS 0", k, multi2);
SendClientMessage(playerid,0xFFFFFFFF,trs);
}
multi2=multi2*2;
}
return 1;
}
So i want your knowledge about this? And what you think about this?


Re: What is bool vs 32 bit new? - RSX - 28.08.2009

Hey why noone says nothing?!


Re: What is bool vs 32 bit new? - Zeex - 28.08.2009

Have you read this topic? These tricks were nicely explained there


Re: What is bool vs 32 bit new? - RSX - 28.08.2009

Oh, wHY i didn't know it before i thought this X@, agh....