[mod_sa C++] Complete Anti-Stun

dphome

Well-known member
Joined
Mar 21, 2020
Messages
475
Solutions
9
Reaction score
168
Location
Poland
cheat_samp.cpp
PHP:
void Complete_AntiStun(void)
{
    traceLastFunc("Complete_AntiStun()");

    if (cheat_state->_generic.cheat_panic_enabled)
        return;
    if (!pGameInterface)
        return;

    struct actor_info *self = actor_info_get(ACTOR_SELF, 0);
    if (self == NULL)
        return;

    if (set.complete_antistun)
    {
        int wID = self->weapon[self->weapon_slot].id;

        if (wID >= 22 && wID <= 24 || wID >= 26 && wID <= 32 || wID >= 37 && wID <= 38 || wID >= 41 && wID <= 42)
        {
            self->pedFlags.bUpperBodyDamageAnimsOnly = true;
            sampNop(RPC_ApplyAnimation, INCOMING_RPC, 1);
        }
        else if(wID == 0)
        {
            self->pedFlags.bUpperBodyDamageAnimsOnly = false;
            sampNop(RPC_ApplyAnimation, INCOMING_RPC, 0);
        }
    }
}

void sampNop(int id, int type, bool enabled)
{
    for (int i = 0; i < 1024; i++)
    {
        if (set.netPatch[i].type == type && set.netPatch[i].id == id)
        {
            set.netPatch[i].enabled = enabled;
            break;
        }
    }
    return;
}
cheat_samp.h
PHP:
void sampNop(int id, int type, bool enabled);
void Complete_AntiStun(void);
cheat.cpp under "// hack some SA:MP, shall we?" like
PHP:
    if (g_SAMP && g_renderSAMP_initSAMPstructs)
    {
        sampMainCheat();
        Complete_AntiStun();
    }
 

dphome

Well-known member
Joined
Mar 21, 2020
Messages
475
Solutions
9
Reaction score
168
Location
Poland
// edit
ACTOR_SELF it -1

struct actor_info *self = actor_info_get(-1, 0);
 
Top