Results 1 to 9 of 9
  1. #1
    ZectixV1's Avatar
    Join Date
    Oct 2014
    Gender
    male
    Location
    Moscow, Russia
    Posts
    1,769
    Reputation
    710
    Thanks
    2,207
    My Mood
    Amused

    Source Code Mega Thread

    From now on post your source code snippets here, don't post full bases/menu's. This is just for code snippets.

    Format:
    Name of cheat
    Code Snippet (use tags)

    GodMode
    Code:
    if (PLAYER_GODMODE == true)
           {
    		PLAYER::SET_PLAYER_INVINCIBLE(PLAYER, true);
    		PED::CLEAR_PED_BLOOD_DAMAGE(PLAYER_PED);
    		PED::RESET_PED_VISIBLE_DAMAGE(PLAYER_PED);
    	}
    if (PLAYER_GODMODE == false)
    	{
    		PLAYER::SET_PLAYER_INVINCIBLE(PLAYER, false);
    	}
    Last edited by ZectixV1; 01-10-2016 at 02:47 AM.







    Threads:
    Resignation
    🚀 GTA: V 1.40 | Mod Menu Mega Thread Revamped | Info Thread 🚀







    Joined - 10-27-2014
    Donated - 3-6-2015
    Minion
    GTAV Minion - 10-12-2015
    CoD Minion - 12-23-2015
    Resigned - 07-17-2016

  2. The Following 2 Users Say Thank You to ZectixV1 For This Useful Post:

    Lunatic (01-20-2016),swwrgaersghaedrgedrgherdhg (05-26-2017)

  3. #2
    ghost30812's Avatar
    Join Date
    Nov 2015
    Gender
    male
    Posts
    104
    Reputation
    10
    Thanks
    624
    My Mood
    In Love
    Clear Wanted Level:

    Code:
    void ClearWantedLevel(Player player)
    {
    	PLAYER::CLEAR_PLAYER_WANTED_LEVEL(player);
    }
    -part of Team Matrix

  4. #3
    TGWW$Twhwrhwhw4ryhrh's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Location
    UK
    Posts
    169
    Reputation
    10
    Thanks
    1,248

    Dealing with tunables

    Ptr class to make reading/writing memory easier:
    Code:
    #include <windows.h>
    #include <initializer_list>
    
    #define naked __declspec(naked)
    
    struct Ptr
    {
        DWORD64 pointer;
    
        explicit Ptr(DWORD64 ptr, std::initializer_list<DWORD64> offsets = {}) : pointer(ptr)
        {
            for each (DWORD64 offset in offsets)
            {
                pointer = *reinterpret_cast<DWORD64*>(pointer);
                pointer += offset;
            }
        }
    
        template <typename T> T get(DWORD64 offset = 0)
        {
            return *reinterpret_cast<T*>(pointer + offset);
        }
    
        template <typename T> void set(T value, DWORD64 offset = 0)
        {
            *reinterpret_cast<T*>(pointer + offset) = value;
        }
    
        void nop(DWORD64 length) const
        {
            for (int i = 0; i < length; ++i)
            {
                *reinterpret_cast<BYTE*>(pointer + i) = 0x90; // nop
            }
        }
    };
    Custom AOB Scanner

    Code:
    #include <windows.h>
    #include <Psapi.h>
    #include <string>
    #include <vector>
    #include <sstream>
    #include <cassert>
    
    DWORD64 AOBScan(DWORD64 begin, DWORD64 end, std::string pattern)
    {
        struct PByte
        {
            byte byte;
            bool ignore;
        };
    
        std::vector<PByte> patterns;
    
        std::stringstream ss;
        ss << pattern;
    
        std::string sByte;
    
        while (ss >> sByte)
        {
            if (sByte == "?" || sByte == "??")
            {
                patterns.push_back({ NULL, true });
            }
            else
            {
                int iByte = stoi(sByte, nullptr, 16);
                assert(iByte >= 0 && iByte <= 255);
                patterns.push_back({ byte(iByte), false });
            }
        }
    
        for (DWORD64 i = begin; i < end - DWORD64(patterns.size()); ++i)
        {
            bool success = true;
    
            for (DWORD64 j = 0; j < DWORD64(patterns.size()); ++j)
            {
                byte memByte = *reinterpret_cast<byte*>(i + j);
                PByte pByte = patterns[j];
                if (memByte != pByte.byte && !pByte.ignore)
                {
                    success = false;
                    break;
                }
            }
    
            if (success)
            {
                return i;
            }
        }
    
        return NULL;
    }
    
    DWORD64 AOBScan(MODULEINFO moduleInfo, std::string pattern)
    {
        DWORD64 begin = DWORD64(moduleInfo.lpBaseOfDll);
        DWORD64 end = begin + DWORD64(moduleInfo.SizeOfImage);
        return AOBScan(begin, end, pattern);
    }
    Get Tunable Pointer
    Code:
    Ptr TunablesPointer()
    {
        DWORD64 base = DWORD64(g_MainModuleInfo.lpBaseOfDll);
        int patternResult = *reinterpret_cast<int*>(AOBScan(g_MainModuleInfo, "48 8B 8C C2 ? ? ? ? 48 85 C9 74 19") + 4);
        return Ptr(base + patternResult + 8, { 16 });
    }
    Get/Set Tunables
    Code:
    template <typename T> void SetTunable(int index, T value)
    {
        static Ptr tunablesPointer = TunablesPointer();
        return tunablesPointer.set(value, index * 8);
    }
    
    template <typename T> T GetTunable(int index)
    {
        static Ptr tunablesPointer = TunablesPointer();
        return tunablesPointer.get<T>(index * 8);
    }
    Last edited by TGWW$Twhwrhwhw4ryhrh; 01-12-2016 at 04:39 AM.

  5. The Following User Says Thank You to TGWW$Twhwrhwhw4ryhrh For This Useful Post:

    FabulousT3rm1n4t0r (06-17-2019)

  6. #4
    afx01's Avatar
    Join Date
    May 2010
    Gender
    male
    Posts
    70
    Reputation
    10
    Thanks
    13
    Quote Originally Posted by Thetechnicbrick View Post
    Ptr class to make reading/writing memory easier:
    Can you please help me adding this to a source based on scripthookv injection (ENT), I tried to use your Brick's Menu source as an example but I failed, of course... I just want to add the snow tunable to the trainer

     

    Code:
    #include <windows.h>
    #include <Psapi.h>
    #include <string>
    #include <vector>
    #include <sstream>
    #include <cassert>
    
    extern MODULEINFO g_MainModuleInfo;
    
    //Custom AOB Scanner
    
    DWORD64 AOBScan(DWORD64 begin, DWORD64 end, std::string pattern)
    {
    	struct PByte
    	{
    		byte byte;
    		bool ignore;
    	};
    
    	std::vector<PByte> patterns;
    
    	std::stringstream ss;
    	ss << pattern;
    
    	std::string sByte;
    
    	while (ss >> sByte)
    	{
    		if (sByte == "?" || sByte == "??")
    		{
    			patterns.push_back({ NULL, true });
    		}
    		else
    		{
    			int iByte = stoi(sByte, nullptr, 16);
    			assert(iByte >= 0 && iByte <= 255);
    			patterns.push_back({ byte(iByte), false });
    		}
    	}
    
    	for (DWORD64 i = begin; i < end - DWORD64(patterns.size()); ++i)
    	{
    		bool success = true;
    
    		for (DWORD64 j = 0; j < DWORD64(patterns.size()); ++j)
    		{
    			byte memByte = *reinterpret_cast<byte*>(i + j);
    			PByte pByte = patterns[j];
    			if (memByte != pByte.byte && !pByte.ignore)
    			{
    				success = false;
    				break;
    			}
    		}
    
    		if (success)
    		{
    			return i;
    		}
    	}
    
    	return NULL;
    }
    
    DWORD64 AOBScan(MODULEINFO moduleInfo, std::string pattern)
    {
    	DWORD64 begin = DWORD64(moduleInfo.lpBaseOfDll);
    	DWORD64 end = begin + DWORD64(moduleInfo.SizeOfImage);
    	return AOBScan(begin, end, pattern);
    }


     

    Code:
    MODULEINFO g_MainModuleInfo = { 0 };
    
    BOOL APIENTRY DllMain(HMODULE hInstance, DWORD reason, LPVOID lpReserved)
    {
    	switch (reason)
    	{
    	case DLL_PROCESS_ATTACH:
    
    		if (!GetModuleInformation(GetCurrentProcess(), GetModuleHandle(nullptr), &g_MainModuleInfo, sizeof(g_MainModuleInfo)))
    		{
    			write_text_to_log_file("Unable to get MODULEINFO from GTA5.exe");
    		}
    		scriptRegister(hInstance, ScriptMain);
    		keyboardHandlerRegister(OnKeyboardMessage);
    		break;
    	case DLL_PROCESS_DETACH:
    		scriptUnregister(ScriptMain);
    		keyboardHandlerUnregister(OnKeyboardMessage);
    		ScriptTidyUp();
    		break;
    	}
    	return TRUE;
    }


     

    #include <windows.h>
    #include <initializer_list>

    #define naked __declspec(naked)

    struct Ptr
    {
    DWORD64 pointer;

    explicit Ptr(DWORD64 ptr, std::initializer_list<DWORD64> offsets = {}) : pointer(ptr)
    {
    for each (DWORD64 offset in offsets)
    {
    pointer = *reinterpret_cast<DWORD64*>(pointer);
    pointer += offset;
    }
    }

    template <typename T> T get(DWORD64 offset = 0)
    {
    return *reinterpret_cast<T*>(pointer + offset);
    }

    template <typename T> void set(T value, DWORD64 offset = 0)
    {
    *reinterpret_cast<T*>(pointer + offset) = value;
    }

    void nop(DWORD64 length) const
    {
    for (int i = 0; i < length; ++i)
    {
    *reinterpret_cast<BYTE*>(pointer + i) = 0x90; // nop
    }
    }
    };


     

    Code:
    Ptr TunablesPointer()
    {
    	DWORD64 base = DWORD64(g_MainModuleInfo.lpBaseOfDll);
    	int patternResult = *reinterpret_cast<int*>(AOBScan(g_MainModuleInfo, "48 8B 8C C2 ? ? ? ? 48 85 C9 74 19") + 4);
    	return Ptr(base + patternResult + 8, { 16 });
    }
    
    bool featureSnow = false;
    
    if (featureSnow)
    {
            SetTunable(4856, 1);
    	SetTunable(7210, 0);
    	SetTunable(7217, 10);
    	SetTunable(7218, 10);
    }
    else
    {
    	SetTunable(4856, 0);
    	SetTunable(7210, 1);
    	SetTunable(7217, 0);
    	SetTunable(7218, 0);
    }


     

    Code:
    Ptr TunablesPointer();
    
    template <typename T> void SetTunable(int index, T value)
    {
    	static Ptr tunablesPointer = TunablesPointer();
    	return tunablesPointer.set(value, index * 8);
    }
    
    template <typename T> T GetTunable(int index)
    {
    	static Ptr tunablesPointer = TunablesPointer();
    	return tunablesPointer.get<T>(index * 8);
    }


    Nothing happens when enabling the option in game
    Last edited by afx01; 02-26-2016 at 10:49 PM.

  7. #5
    kevzuidwest's Avatar
    Join Date
    Feb 2016
    Gender
    male
    Location
    The Netherlands
    Posts
    63
    Reputation
    21
    Thanks
    1,169
    My Mood
    Hot
    Explosive ammo, make sure to call it inside your loop:

    Code:
    SET_EXPLOSIVE_AMMO_THIS_FRAME(playerhandle);

  8. #6
    astron51's Avatar
    Join Date
    Oct 2011
    Gender
    male
    Location
    Stuttgart, Germany
    Posts
    618
    Reputation
    57
    Thanks
    4,939
    My Mood
    Dead
    Max Vehicle

    Code:
    void Max_veh(Vehicle VehicleHandle) {
    	SET_VEHICLE_FIXED(VehicleHandle);
    	SET_VEHICLE_DEFORMATION_FIXED(VehicleHandle);
    	SET_VEHICLE_DIRT_LEVEL(VehicleHandle, 0);
    	SET_VEHICLE_TYRES_CAN_BURST(VehicleHandle, 0);
    	SET_VEHICLE_WHEELS_CAN_BREAK(VehicleHandle, 0);
    	SET_VEHICLE_HAS_STRONG_AXLES(VehicleHandle, 1);
    	SET_VEHICLE_MOD_KIT(VehicleHandle, 0);
    	SET_VEHICLE_CUSTOM_SECONDARY_COLOUR(VehicleHandle, rand() % 255, rand() % 255, rand() % 255);
    	SET_VEHICLE_CUSTOM_PRIMARY_COLOUR(VehicleHandle, rand() % 255, rand() % 255, rand() % 255);
    	TOGGLE_VEHICLE_MOD(VehicleHandle, 18, 1);
    	TOGGLE_VEHICLE_MOD(VehicleHandle, 22, 1);
    	SET_VEHICLE_MOD(VehicleHandle, 16, 5, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 12, 2, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 11, 3, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 14, 14, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 15, 3, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 13, 2, 0);
    	SET_VEHICLE_WHEEL_TYPE(VehicleHandle, 6);
    	SET_VEHICLE_WINDOW_TINT(VehicleHandle, 1);
    	SET_VEHICLE_MOD(VehicleHandle, 23, 14, 2);
    	SET_VEHICLE_MOD(VehicleHandle, 0, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 1, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 2, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 3, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 4, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 5, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 6, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 7, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 8, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 9, 1, 0);
    	SET_VEHICLE_MOD(VehicleHandle, 10, 1, 0);
    	_SET_VEHICLE_NEON_LIGHT_ENABLED(VehicleHandle, 0, 1);
    	_SET_VEHICLE_NEON_LIGHT_ENABLED(VehicleHandle, 1, 1);
    	_SET_VEHICLE_NEON_LIGHT_ENABLED(VehicleHandle, 2, 1);
    	_SET_VEHICLE_NEON_LIGHT_ENABLED(VehicleHandle, 3, 1);
    	_SET_VEHICLE_NEON_LIGHTS_COLOUR(VehicleHandle, rand() % 255, rand() % 255, rand() % 255);
    	SET_VEHICLE_NUMBER_PLATE_TEXT_INDEX(VehicleHandle, PLATE_YELLOWONBLACK);
    	SET_VEHICLE_NUMBER_PLATE_TEXT(VehicleHandle, "MPGH");
    
    }

    Quote Originally Posted by Aula View Post
    FaQ2: Will my Main account will get ban?
    -Hell yeah . Who ask u to use this 3rd party program on ur main account ? Fcking Idiot .

    Get 100 Thanks - ✔
    Get 200 Thanks - ✔
    Get 300 Thanks - ✔
    Get 400 Thanks - ✔
    Get 500 Thanks - ✔
    Get 600 Thanks - ✔
    Get 700 Thanks - ✔
    Get 800 Thanks - ✔
    Get 900 Thanks - ✔
    Get 1000 Thanks - ✔
    Get 1500 Thanks - ✔
    Get 2000 Thanks - ✔
    Get 2500 Thanks - ✔
    Achievement Completed.

  9. #7
    PhucedMODZ's Avatar
    Join Date
    Jan 2017
    Gender
    male
    Posts
    2
    Reputation
    10
    Thanks
    0
    My Mood
    Inspired
    Put This In Your Other Loop
    Code:
    if(godmode[0]){
            PLAYER::SET_PLAYER_INVINCIBLE(PLAYER, true);
            PED::CLEAR_PED_BLOOD_DAMAGE(PLAYER_PED);
            PED::RESET_PED_VISIBLE_DAMAGE(PLAYER_PED);
    }
    else{
    	PLAYER::SET_PLAYER_INVINCIBLE(PLAYER, false);
    }
    Put This Is Your Submenu Options
    Code:
    addBoolOption("GodMode", &godmode[0]);
    Put This In Your Switch
    Code:
    case 1: if (!godmode[0]){
            drawNotification("GodMode ~r~Disabled");
    }
    else{
            drawNotification("GodMode ~g~Enabled");
    }
    break;
    Put This Near The Top Of Your File
    Code:
    bool godmode[50];
    Use the checkboxes in bool arrays, looks cleaner
    Last edited by PhucedMODZ; 01-12-2018 at 11:45 AM. Reason: Wrote it on my phone, so adding the [code] bb tags to it

  10. #8
    swwrgaersghaedrgedrgherdhg's Avatar
    Join Date
    Jan 2014
    Gender
    male
    Posts
    2,520
    Reputation
    195
    Thanks
    6,456
    My Mood
    Doh
    Quote Originally Posted by PhucedMODZ View Post
    Put This In Your Other Loop
    Code:
    if(godmode[0]){
            PLAYER::SET_PLAYER_INVINCIBLE(PLAYER, true);
            PED::CLEAR_PED_BLOOD_DAMAGE(PLAYER_PED);
            PED::RESET_PED_VISIBLE_DAMAGE(PLAYER_PED);
    }
    else{
    	PLAYER::SET_PLAYER_INVINCIBLE(PLAYER, false);
    }
    Put This Is Your Submenu Options
    Code:
    addBoolOption("GodMode", &godmode[0]);
    Put This In Your Switch
    Code:
    case 1: if (!godmode[0]){
            drawNotification("GodMode ~r~Disabled");
    }
    else{
            drawNotification("GodMode ~g~Enabled");
    }
    break;
    Put This Near The Top Of Your File
    Code:
    bool godmode[50];
    Use the checkboxes in bool arrays, looks cleaner
    That is detected and poorly optimized you moron
    Last edited by swwrgaersghaedrgedrgherdhg; 01-12-2018 at 05:33 PM.

  11. The Following User Says Thank You to swwrgaersghaedrgedrgherdhg For This Useful Post:

    ZectixV1 (01-14-2018)

  12. #9
    mich8989's Avatar
    Join Date
    Feb 2020
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    11
    nice thanks

Similar Threads

  1. Modern Warfare 3 Source Code / Address Thread
    By lolbie in forum Call of Duty 8 - Modern Warfare 3 (MW3) Hacks & Cheats
    Replies: 281
    Last Post: 11-06-2020, 12:53 AM
  2. CrossFire Hack Source Code Resource Thread
    By Hero in forum CrossFire Hack Coding / Programming / Source Code
    Replies: 0
    Last Post: 07-04-2012, 01:58 AM
  3. [Info] Source Code Section Thread List
    By CoderNever in forum Combat Arms Hack Coding / Programming / Source Code
    Replies: 8
    Last Post: 05-14-2012, 08:16 AM
  4. [Source Code] Battlefield 3 Hack Source Code / Reversal Thread
    By Helper in forum Battlefield 3 (BF3) Hacks & Cheats
    Replies: 7
    Last Post: 01-14-2012, 01:25 AM
  5. Muti-Tool, Tool Codes [Mega-Thread] + Mini-Chams & Croshair
    By ultahackers in forum Combat Arms Spammers, Injectors and Multi Tools
    Replies: 17
    Last Post: 12-04-2010, 10:50 PM