Quote:
Originally Posted by AndreT
What I meant was that even though the speed difference isn't noticeable in any case, it would make more sense to get the name only once during the process. I'm not saying that to bitch about efficiency or speed, I'm just hoping that coders who learn from tutorials do not get used to having useless wrapper functions like you have shown them. I'm not trying to offend you or anything though.
|
It's okay, though I don't see whats the point of going through the whole process of just replacing ReturnPlayerName, but what ever you say. I'll be replacing it in the next version along with using DB_Escape to exit exploits. The estimated time when this'll come is unknown due to me being quite busy at the moment.
EDIT: I've now updated the tutorial
![Smiley](images/smilies/smile.png)
[ Version: 1.5 ]
Quote:
Originally Posted by vIBIENNYx
Hey, I have encountered a small problem, even though I have downloaded rBits.inc and placed it in the "Include" folder I receive and error stating it cannot find / read it..
Can you help me please?
|
Replace your
rBits include with:
pawn Code:
/*
SA-MP "rBits" Include
Copyright © 2011 RyDeR`
*/
#if defined _Included_rBits
#endinput
#endif
#define _Included_rBits
#define BIT_TAGS \
{ Bit1, Bit2, Bit4, Bit8, Bit16 }
enum e_Bits
{
Bit1,
Bit2,
Bit4,
Bit8,
Bit16,
Bit32
};
#define Bit1:%0<%1> \
Bit1: %0[((%1) + 31) >>> _: Bit32]
#define Bit1_Set(%0,%1,%2) \
Bit_Set(%0, (%1), (%2), Bit1)
#define Bit1_Get(%0,%1) \
Bit_Get(%0, (%1), Bit1)
#define Bit2:%0<%1> \
Bit2: %0[((%1) + 15) >>> _: (Bit32 - Bit2)]
#define Bit2_Set(%0,%1,%2) \
Bit_Set(%0, (%1), (%2), Bit2)
#define Bit2_Get(%0,%1) \
Bit_Get(%0, (%1), Bit2)
#define Bit4:%0<%1> \
Bit4: %0[((%1) + 7) >>> _: (Bit32 - Bit4)]
#define Bit4_Set(%0,%1,%2) \
Bit_Set(%0, (%1), (%2), Bit4)
#define Bit4_Get(%0,%1) \
Bit_Get(%0, (%1), Bit4)
#define Bit8:%0<%1> \
Bit8: %0[(%1) char]
#define Bit8_Set(%0,%1,%2) \
(_: %0{(%1)} = (%2))
#define Bit8_Get(%0,%1) \
(_: %0{(%1)})
#define Bit16:%0<%1> \
Bit16: %0[((%1) + 1) >>> _: (Bit32 - Bit16)]
#define Bit16_Set(%0,%1,%2) \
Bit_Set(%0, (%1), (%2), Bit16)
#define Bit16_Get(%0,%1) \
Bit_Get(%0, (%1), Bit16)
stock Bit_Set(BIT_TAGS: bitArr[], arrIdx, value, e_Bits: bitShift, arrSize = sizeof(bitArr))
{
new
bitVar = ((arrIdx & ((1 << _: (Bit32 - bitShift)) - 1)) << _: bitShift),
bitLim = ((1 << (1 << _: bitShift)) - 1)
;
if(!(0 <= (arrIdx >>>= _: (Bit32 - bitShift)) < arrSize))
return 0;
(_: bitArr[arrIdx]) &= ~(bitLim << bitVar);
(_: bitArr[arrIdx]) |= ((bitLim & value) << bitVar);
return 1;
}
stock Bit_Get(BIT_TAGS: bitArr[], arrIdx, e_Bits: bitShift, arrSize = sizeof(bitArr))
{
new
bitVar = ((arrIdx & ((1 << _: (Bit32 - bitShift)) - 1)) << _: bitShift),
bitLim = ((1 << (1 << _: bitShift)) - 1)
;
if(!(0 <= (arrIdx >>>= _: (Bit32 - bitShift)) < arrSize))
return 0;
return ((_: bitArr[arrIdx] >>> bitVar) & bitLim);
}
I get no errors on this.