Rambizz1

Member
Joined
Feb 2, 2024
Messages
7
Solutions
1
Reaction score
0
Hello everyone, I’m wondering how people make this function.
My Silent Aim code is basic but working on every SA:MP server.

I’m using EmulateStunShot and GenerateDamageEvent.
I tested it with my friends — they see the blood, they see the bullet coming towards them, and they get stunned when I use a stunning weapon, but I can’t see any of this on my screen.


Here is the GenerateDamageEvent function I’m using:

C++:
//GenerateDamageEvent(CPed, CEntity, eWeaponType, int damage_per_hit, ePedPieceTypes hitpart, int weaponID);
void CWeaponSA::GenerateDamageEvent(CPed* pFiringEntity, CEntity* pEntity, eWeaponType weaponType, int damage_per_hit, int hitpart, int weaponid)
{
    DWORD dwFiringEntityInterface = 0;
    if (pFiringEntity) dwFiringEntityInterface = (DWORD)pFiringEntity->GetInterface();

    DWORD dwTargetEntityInterface = 0;
    if (pEntity) dwTargetEntityInterface = (DWORD)pEntity->GetInterface();

    DWORD dwThis = (DWORD)internalInterface;
    DWORD dwFunc = FUNC_CWeapon_GenerateDamageEvent;

    _asm
    {
        mov     ecx, dwThis
        push    weaponid      // int weaponID
        push    hitpart       // int hitpart
        push    damage_per_hit // int damage_per_hit
        push    weaponType    // eWeaponType
        push    dwTargetEntityInterface // CEntity interface
        push    dwFiringEntityInterface // CPed interface
        call    dwFunc
    }
}

Can you guys help me make the blood splatter visible for the local player as well?
 
Solution
Hello guys! I have new updates. I have found how to make it, here is the code:

FIRST OF ALL
You need to include GameScripting to your source code
(La Pirula Project Source has it)
ADD THIS CODE INTO YOUR SILENT AIM

C++:
actor_info* player = getGTAPedFromSAMPPlayerID(cheat_state->aimSettings.iAimPlayerID);
CPed* pPed = pGameInterface->GetPools()->GetPed((DWORD*)player);
CVector fBonePos;
pPed->GetBonePosition((eBone)BONE_HEAD/*you can put any bone in here*/, &fBonePos);

const SCRIPT_COMMAND create_blood_gush_at = { 0x09B8, "ffffffii" };

float x = fBonePos.fX;
float y = fBonePos.fY;
float z = fBonePos.fZ...

Rambizz1

Member
Joined
Feb 2, 2024
Messages
7
Solutions
1
Reaction score
0
Hello guys! I have new updates. I have found how to make it, here is the code:

FIRST OF ALL
You need to include GameScripting to your source code
(La Pirula Project Source has it)
ADD THIS CODE INTO YOUR SILENT AIM

C++:
actor_info* player = getGTAPedFromSAMPPlayerID(cheat_state->aimSettings.iAimPlayerID);
CPed* pPed = pGameInterface->GetPools()->GetPed((DWORD*)player);
CVector fBonePos;
pPed->GetBonePosition((eBone)BONE_HEAD/*you can put any bone in here*/, &fBonePos);

const SCRIPT_COMMAND create_blood_gush_at = { 0x09B8, "ffffffii" };

float x = fBonePos.fX;
float y = fBonePos.fY;
float z = fBonePos.fZ;

ScriptCommand(&create_blood_gush_at,
   x, y, z,            // position of blood that is going to be shown
   0.0f, 0.0f, 0.0f,   // offsets
   3,                 // density
   1                  // is it going to be on actor or nah
);

ADD THIS CODE INTO YOUR static int init ( void ) IN MAIN.CPP
It makes the SCRIPT_COMMAND code start unless game crashes

C++:
InitScripting();

Thats all! Now enjoy your p100 blood effect!
 
Solution
Top