Jump to content

[SA] CLEO. Is it possible to disable melee attacks by player ?


vladvo

Recommended Posts

There is a topic with the same question already, but it's like 9 years old and it is unanswered. 

0881 SET_PLAYER_FIRE_BUTTON is not doing it's job. CJ can't shoot but he can punch.

I tried to search for something like that in IDA - no luck. 

Checked the hold_cellphone task - it seems that the game creates cellphone in CJ's hand as a weapon, not as an object. And this is why he don't punch while holding it.  Any ideas ?

Edited by vladvo
Wrong assumption
Link to comment
Share on other sites

1 hour ago, vladvo said:

Cleo.

Well, I've done it in C++ if you want that version. As for CLEO maybe you can do it by checking if the player's active task is TASK_SIMPLE_FIGHT (1016) and then use 0687 CLEAR_CHAR_TASKS or 0792 CLEAR_CHAR_TASKS_IMMEDIATELY

Link to comment
Share on other sites

35 minutes ago, cjfan_ said:

Well, I've done it in C++ if you want that version.

I'd like to take a look at the source. Maybe I'll find a way to use it.

Link to comment
Share on other sites

4 minutes ago, vladvo said:

I'd like to take a look at the source. Maybe I'll find a way to use it.

#include "plugin.h"

#include "CPed.h"
#include "../injector/hooking.hpp"

using namespace plugin;

uint32_t originalAddress = 0;

bool __fastcall CTaskSimpleFight__ProcessPed(CTaskSimpleFight* _this, int, CPed* ped)
{
    if (ped && FindPlayerPed() == ped && ped->m_nActiveWeaponSlot < 1)
        _this->m_bIsFinished = 1;

    return reinterpret_cast<bool(__thiscall*)(CTaskSimpleFight*, CPed*)>(originalAddress)(_this, ped);
}

class DisableMelee {
public:
    DisableMelee() {        
        originalAddress = *(uint32_t*)0x86D6A0;
        injector::WriteMemory<uint32_t>(0x86D6A0, (uint32_t)&CTaskSimpleFight__ProcessPed, true);
    }
} disableMelee;

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.