SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 21/08/2011, 02:43 AM   #101
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,800
Reputation: 1160
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Yeah getting a error here:
Code:
rBits.inc(1) : error 010: invalid function or declaration
Can anyone pass me a old version of this include? May work.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 21/08/2011, 03:17 AM   #102
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Quote:
Originally Posted by Lorenc_ View Post
Yeah getting a error here:
Code:
rBits.inc(1) : error 010: invalid function or declaration
Can anyone pass me a old version of this include? May work.
This is and was the only version untill now. What's on line 1?
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 21/08/2011, 03:11 PM   #103
System64
Gangsta
 
System64's Avatar
 
Join Date: May 2011
Location: Zadar, Croatia
Posts: 933
Reputation: 143
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

I've found my problem, problem is that I can't use Bit_Set, than eq. BitSet, why?
__________________
All my works
I left SA:MP! Maybe once I start scripting again but now I'm based on web programming
Soon, I'll buy domain system32.com.hr but for now you can contact me on LogoOff or on my Youtube channel!
System64 is offline   Reply With Quote
Old 22/08/2011, 04:52 PM   #104
GangsTa_
High-roller
 
GangsTa_'s Avatar
 
Join Date: May 2010
Location: Republic of Moldova
Posts: 1,029
Reputation: 51
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

This is just what I needed.
__________________
i5-5200U @ 2.6 GHz
GTX 950M 2GB GDDR3 128-bit
8,00GB DDR3 RAM
128GB SSD, 1TB 5400RPM HDD
Windows 10 Pro x64
GangsTa_ is offline   Reply With Quote
Old 24/08/2011, 10:03 AM   #105
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,800
Reputation: 1160
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Quote:
Originally Posted by RyDeR` View Post
This is and was the only version untill now. What's on line 1?
Nothing, though I managed to ask TheKiller for his version of the Include, works perfectly now. Theres nothing in the include. It's completely clean and it gives the error.
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 28/08/2011, 01:14 AM   #106
Gh0sT_
Gangsta
 
Join Date: Sep 2010
Location: Lithuania, Alytus
Posts: 704
Reputation: 0
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

can I set negative values?

e.g: BitX_Set(array, id, -1);
__________________
Includes
Player/Vehicle Control
Entrances system
Gh0sT_ is offline   Reply With Quote
Old 28/08/2011, 03:37 AM   #107
RyDeR`
High-roller
 
RyDeR`'s Avatar
 
Join Date: Feb 2009
Location: Belgium
Posts: 2,929
Reputation: 700
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Quote:
Originally Posted by Gh0sT_ View Post
can I set negative values?

e.g: BitX_Set(array, id, -1);
Yes but no. When you set for example -1 at 4 bits, the value will become 15. If you do the same for -2 the value will becomw 14. Same way of working for other bit types.
__________________

Sup?
RyDeR` is offline   Reply With Quote
Old 28/08/2011, 04:46 AM   #108
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,800
Reputation: 1160
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Just renamed most functions/defines so they don't conflict with YSI.

to anyone that wants it:
pawn Code:
/*
    SA-MP "rBits" Include
    Copyright 2011 RyDeR`
*/


#if defined _Included_rBits
    #endinput
#endif

#define _Included_rBits

#define BIT_TAGS \
    { rBit1, rBit2, rBit4, rBit8, rBit16 }

enum e_Bits
{
    rBit1,
    rBit2,
    rBit4,
    rBit8,
    rBit16,
    rBit32
};

#define rBit1:%0<%1> \
    rBit1: %0[((%1) + 31) >>> _: rBit32]

#define rBit1_Set(%0,%1,%2) \
    rBit_Set(%0, (%1), (%2), rBit1)

#define rBit1_Get(%0,%1) \
    rBit_Get(%0, (%1), rBit1)

#define rBit2:%0<%1> \
    rBit2: %0[((%1) + 15) >>> _: (rBit32 - rBit2)]

#define rBit2_Set(%0,%1,%2) \
    rBit_Set(%0, (%1), (%2), rBit2)

#define rBit2_Get(%0,%1) \
    rBit_Get(%0, (%1), rBit2)

#define rBit4:%0<%1> \
    rBit4: %0[((%1) + 7) >>> _: (rBit32 - rBit4)]

#define rBit4_Set(%0,%1,%2) \
    rBit_Set(%0, (%1), (%2), rBit4)

#define rBit4_Get(%0,%1) \
    rBit_Get(%0, (%1), rBit4)

#define rBit8:%0<%1> \
    rBit8: %0[(%1) char]

#define rBit8_Set(%0,%1,%2) \
    (_: %0{(%1)} = (%2))

#define rBit8_Get(%0,%1) \
    (_: %0{(%1)})

#define rBit16:%0<%1> \
    rBit16: %0[((%1) + 1) >>> _: (rBit32 - rBit16)]

#define rBit16_Set(%0,%1,%2) \
    rBit_Set(%0, (%1), (%2), rBit16)

#define rBit16_Get(%0,%1) \
    rBit_Get(%0, (%1), rBit16)

stock rBit_Set(BIT_TAGS: bitArr[], arrIdx, value, e_Bits: bitShift, arrSize = sizeof(bitArr))
{
    new
        bitVar = ((arrIdx & ((1 << _: (rBit32 - bitShift)) - 1)) << _: bitShift),
        bitLim = ((1 << (1 << _: bitShift)) - 1)
    ;
    if(!(0 <= (arrIdx >>>= _: (rBit32 - bitShift)) < arrSize))
        return 0;

    (_: bitArr[arrIdx]) &= ~(bitLim << bitVar);
    (_: bitArr[arrIdx]) |= ((bitLim & value) << bitVar);

    return 1;
}

stock rBit_Get(BIT_TAGS: bitArr[], arrIdx, e_Bits: bitShift, arrSize = sizeof(bitArr))
{
    new
        bitVar = ((arrIdx & ((1 << _: (rBit32 - bitShift)) - 1)) << _: bitShift),
        bitLim = ((1 << (1 << _: bitShift)) - 1)
    ;
    if(!(0 <= (arrIdx >>>= _: (rBit32 - bitShift)) < arrSize))
        return 0;

    return ((_: bitArr[arrIdx] >>> bitVar) & bitLim);
}

You just need to add a 'r' next to your function(s).
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777


Last edited by Lorenc_; 28/08/2011 at 05:26 AM.
Lorenc_ is offline   Reply With Quote
Old 28/08/2011, 09:45 AM   #109
System64
Gangsta
 
System64's Avatar
 
Join Date: May 2011
Location: Zadar, Croatia
Posts: 933
Reputation: 143
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

thanks lorenc *_____*
__________________
All my works
I left SA:MP! Maybe once I start scripting again but now I'm based on web programming
Soon, I'll buy domain system32.com.hr but for now you can contact me on LogoOff or on my Youtube channel!
System64 is offline   Reply With Quote
Old 28/08/2011, 09:50 AM   #110
oFLu
Little Clucker
 
oFLu's Avatar
 
Join Date: Jul 2011
Posts: 45
Reputation: 4
Default Re: rBits [supports 16, 8, 4, 2 and 1-bit arrays]

Ne İse Yaradıgını Anlamadım İngilizcem Kotudur

Thanks
__________________
oFLu is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] vDealer, probally the most simple vehicledealer system (Supports Y_INI & MYSQL!) Make your own vehicleshops in 1 line! gamer931215 Includes 122 19/05/2014 03:54 PM
TrueServe doesn't supports Hosted Tab? Ouch_Charlie General 3 14/05/2011 03:30 PM
[FilterScript] [FS] ezConverter - Now supports CreateVehicle! Rzzr Filterscripts 13 16/03/2010 10:25 PM
[DAntiCheat] Bye Bye cheaters ... (0.12, SUPPORTS ONLY 0.1b) DracoBlue Filterscripts 261 20/10/2009 11:20 AM


All times are GMT. The time now is 10:44 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.