Quantcast
Channel: NextGenUpdate
Viewing all articles
Browse latest Browse all 27691

[C++] All Client Button Monitoring

$
0
0
Hey guys recently I started making all of my stuff in C++ because of the release of the method for .sprx modding. So here is a button monitoring script I have made... Hope this helps you with your menus/binds! :)

ReadInt function:
Code:

int intArray[100];
int* ReadInt(int address, int length)
{
    for (int i = 0; i < length; i++)
    {
        intArray[i] =  *(int*)(address + (i * 0x04));
    }
    return intArray;
}


Button Monitoring:
Code:

namespace Buttons
{
    int
    X = 262144,
    Square = 805306368,
    L1 = 526336,
    L2 = 8388608,
    L3 = 35651584,
    R1 = 16777216,
    R2 = 4194304,
    R3 = 67108868;
};
   
bool ButtonPressed(int Client, int Button)
{
    if (*(int*)Mem::ReadInt(0xF47CB0 + (Client * 0x3700), 1) == Button)
        return true;
    else return false;
}


How to use:
Code:

//Run in a thread
void Test()
{
    for (;;)
    {
        if (ButtonPressed(0, Buttons::X)
            iPrintln(0, "Client 0 Pressed X!");
        else if (ButtonPressed(1, Buttons::R1)
            iPrintln(1, "Client 1 Pressed R1!");
    }
}

Credits
Me - Making script
seb5594 - Button monitoring offset

Viewing all articles
Browse latest Browse all 27691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>