Results 1 to 10 of 10
  1. #1
    Lokeeh's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    56
    Reputation
    10
    Thanks
    18
    My Mood
    Yeehaw

    Coding Issues with trigg bots latley :3

    The cons of a raytrace only triggerbot are:
    CGameTrace::hitbox is not reliable
    CGameTrace::hitgroup is reliable but only related to the studio MODEL (not hitbox!) So it is possible that you aim at the body and your Triggerbot shoots but will not hit the hitbox.

    By combining the raytrace triggerbot with the rayintersection functions from the sdk we have a perfect solution and balance between fps consumption and 100% reliable results.

    Code:

    //SDK RIP fixed to work with d3dvector and removed useless stuff
    bool IntersectRayWithOBB(const D3DXVECTOR3 &vecRayStart, const D3DXVECTOR3 &vecRayDelta,
    const matrix3x4_t &matOBBToWorld, const D3DXVECTOR3 &vecOBBMins, const D3DXVECTOR3 &vecOBBMaxs)
    {


    // OPTIMIZE: Store this in the box instead of computing it here
    // compute center in local space
    D3DXVECTOR3 vecBoxExtents = (vecOBBMins + vecOBBMaxs) * 0.5;
    D3DXVECTOR3 vecBoxCenter;


    // transform to world space
    VectorTransform(vecBoxExtents, matOBBToWorld, vecBoxCenter);


    // calc extents from local center
    vecBoxExtents = vecOBBMaxs - vecBoxExtents;


    // OPTIMIZE: This is optimized for world space. If the transform is fast enough, it may make more
    // sense to just xform and call UTIL_ClipToBox() instead. MEASURE THIS.


    // save the extents of the ray along
    D3DXVECTOR3 extent, uextent;
    D3DXVECTOR3 segmentCenter = vecRayStart + vecRayDelta - vecBoxCenter;


    extent.x = extent.y = extent.z = 0.0f;


    // check box axes for separation
    for (int j = 0; j < 3; j++)
    {
    extent[j] = vecRayDelta.x * matOBBToWorld[0][j] + vecRayDelta.y * matOBBToWorld[1][j] + vecRayDelta.z * matOBBToWorld[2][j];
    uextent[j] = fabsf(extent[j]);
    float coord = segmentCenter.x * matOBBToWorld[0][j] + segmentCenter.y * matOBBToWorld[1][j] + segmentCenter.z * matOBBToWorld[2][j];
    coord = fabsf(coord);


    if (coord >(vecBoxExtents[j] + uextent[j]))
    return false;
    }


    // now check cross axes for separation
    float tmp, cextent;
    D3DXVECTOR3 cross;
    D3DXVec3Cross(&cross, &vecRayDelta, &segmentCenter);// = vecRayDelta.Cross(segmentCenter);


    cextent = cross.x * matOBBToWorld[0][0] + cross.y * matOBBToWorld[1][0] + cross.z * matOBBToWorld[2][0];
    cextent = fabsf(cextent);
    tmp = vecBoxExtents[1] * uextent[2] + vecBoxExtents[2] * uextent[1];
    if (cextent > tmp)
    return false;


    cextent = cross.x * matOBBToWorld[0][1] + cross.y * matOBBToWorld[1][1] + cross.z * matOBBToWorld[2][1];
    cextent = fabsf(cextent);
    tmp = vecBoxExtents[0] * uextent[2] + vecBoxExtents[2] * uextent[0];
    if (cextent > tmp)
    return false;


    cextent = cross.x * matOBBToWorld[0][2] + cross.y * matOBBToWorld[1][2] + cross.z * matOBBToWorld[2][2];
    cextent = fabsf(cextent);
    tmp = vecBoxExtents[0] * uextent[1] + vecBoxExtents[1] * uextent[0];
    if (cextent > tmp)
    return false;


    return true;
    }



    The main triggerbot function:
    bool Aimbot::Trigger(CUserCmd *pCommand, IClientEntity *pLocal)
    {
    CGameTrace tr;
    D3DXVECTOR3 Src, Dst, vAngle, min, max, delta;
    matrix3x4_t matrix[128];
    studiohdr_t* pStudioHdr;
    mstudiohitboxset_t* pHitboxSet;
    mstudiobbox_t* box;
    IClientEntity* pEnemy;


    //Setup our "look vector"
    Src = pLocal->GetEyePos();
    vAngle = pCommand->viewangles;


    AngleVectors(vAngle, &vAngle);


    D3DXVec3Normalize(&vAngle, &vAngle);
    D3DXVec3Scale(&vAngle, &vAngle, 8192.f);


    Dst = Src + vAngle;


    //Call traceline
    _asm
    {
    MOV EAX, pLocal
    LEA ECX, tr
    PUSH ECX
    PUSH 0
    PUSH EAX
    PUSH 0x4600400B
    LEA EDX, Dst
    LEA ECX, Src
    CALL dwTraceLine;
    ADD ESP, 0x10
    }

    //If we don't hit a human we return
    if (!(tr.hitgroup <= 10 && tr.hitgroup > 0))
    return false;

    if (!tr.m_pEnt)
    return false;


    pEnemy = (IClientEntity*)tr.m_pEnt;


    //We only want to hit enemys
    if (pEnemy->GetTeamNum() == pLocal->GetTeamNum())
    return false;


    if (!pEnemy->SetupBones(matrix, 128, 0x00000100, engineClient->Time()))
    return false;


    //Get our model studio stuff
    PVOID model = pEnemy->GetModelpointer();
    if (!model)
    return false;


    pStudioHdr = modelClient->GetStudiomodel(model);
    if (!pStudioHdr)
    return false;


    pHitboxSet = pStudioHdr->pHitboxSet(0);//0 for testing, use netvar later
    if (!pHitboxSet)
    return false;


    //Create the delta
    D3DXVec3Subtract(&delta, &Dst, &Src);


    //Loop through all hitboxes and see if we can hit one
    for (int i = 0; i < pHitboxSet->numhitboxes; i++)
    {
    box = pHitboxSet->pHitbox(i);
    if (!box)
    continue;


    //Scale down hitboxes to ensure a hit (you can remove this, but i prefer having smaller hitboxes to be a little bit more legit )
    D3DXVec3Scale(&min, &box->bbmin, 0.8f);
    D3DXVec3Scale(&max, &box->bbmax, 0.8f);


    //Check if we hit the box
    if (IntersectRayWithOBB(Src, delta, matrix[box->bone], min, max))
    return true;
    }

    //We didn't hit anything
    return false;


    }

    Hope this can help ;~;

  2. The Following User Says Thank You to Lokeeh For This Useful Post:

    Deearegee17 (08-05-2014)

  3. #2
    AIMWARE's Avatar
    Join Date
    Aug 2014
    Gender
    female
    Posts
    48
    Reputation
    10
    Thanks
    46
    This code is super messy.
    Also, why not check if they are dead as well?

  4. #3
    D3M0L1T10N's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    1,364
    Reputation
    19
    Thanks
    656
    Quote Originally Posted by ******* View Post
    This code is super messy.
    Also, why not check if they are dead as well?
    good acount A+

  5. #4
    GBot!'s Avatar
    Join Date
    Mar 2010
    Gender
    male
    Location
    Long Beach
    Posts
    3,361
    Reputation
    320
    Thanks
    421
    My Mood
    Amazed
    Quote Originally Posted by ******* View Post
    This code is super messy.
    Also, why not check if they are dead as well?
    Hello trollaux

  6. #5
    Lokeeh's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    56
    Reputation
    10
    Thanks
    18
    My Mood
    Yeehaw
    Quote Originally Posted by ******* View Post
    This code is super messy.
    Also, why not check if they are dead as well?
    Ayyy, Brutha you do what you need to do to the coding and make it the way you want :3
    no need to say negative things like that ^-^ do what you do and keep it to yourself .-.

  7. #6
    Epilex's Avatar
    Join Date
    Nov 2013
    Gender
    male
    Posts
    128
    Reputation
    10
    Thanks
    7
    code is really messy, pls use tab. xd. also the only people who would be using it are ppl who know how to code c++. so the notes just make the code look 10x worse.
    you have a point w/ the way you use raytrace, but anyone that's been making their own private cheat (and isnt an idiot), uses the method you specified. heck, I've been using that method for 3-4 months now after I noticed the inconsistency of my old tbot.

  8. #7
    AIMWARE's Avatar
    Join Date
    Aug 2014
    Gender
    female
    Posts
    48
    Reputation
    10
    Thanks
    46
    Quote Originally Posted by G View Post

    Hello trollaux
    Hello skidatron 5000, I see you have quoted my post.

  9. #8
    AIMWARE's Avatar
    Join Date
    Aug 2014
    Gender
    female
    Posts
    48
    Reputation
    10
    Thanks
    46
    Quote Originally Posted by D3M0L1T10N View Post
    good acount A+
    D3M0L1T1ON
    ONE STEP AHEAD OF THE MEMES

    You must be nerve, right?
    Last edited by AIMWARE; 08-06-2014 at 10:34 PM.

  10. #9
    D3M0L1T10N's Avatar
    Join Date
    May 2012
    Gender
    male
    Posts
    1,364
    Reputation
    19
    Thanks
    656
    Quote Originally Posted by ******* View Post
    D3M0L1T1ON
    ONE STEP AHEAD OF THE MEMES

    You must be nerve, right?
    reported for griefing

  11. #10
    rasashai7's Avatar
    Join Date
    Aug 2014
    Gender
    male
    Posts
    50
    Reputation
    10
    Thanks
    7
    My Mood
    Stressed
    did you copy and paste this from uc?

Similar Threads

  1. How to do OPK + Code Cave with a debugger and C++
    By radnomguywfq3 in forum C++/C Programming
    Replies: 4
    Last Post: 12-08-2009, 12:00 PM
  2. Help with source code! Easy fast scope bot!
    By Zoom in forum C++/C Programming
    Replies: 22
    Last Post: 08-21-2009, 09:06 PM
  3. help with gp bot v4
    By _-?chubi?-_ in forum Combat Arms Hacks & Cheats
    Replies: 3
    Last Post: 02-15-2009, 05:58 PM
  4. Technical issue with profile
    By WOLF01234 in forum Call of Duty 5 - World at War Hacks
    Replies: 1
    Last Post: 12-11-2008, 07:15 PM
  5. Bulding a hack and got some issue with pointers
    By TheRedEye in forum WarRock - International Hacks
    Replies: 8
    Last Post: 05-16-2007, 04:43 PM