Welcome to Ramleague,

Ramleague - the best site for pinoy chat, games chat and mobiles chat,

Sign Up
  1. Hello guest Guest , Are you tired from Ads? to remove some ads you need to register and be active. :D

[Source Code] Objectmgr_fn

Discussion in 'CrossFire Source Code & Tutorials' started by oijasoidu172hjn, May 29, 2020.

  1. oijasoidu172hjn Adict Gamer
    Member Lvl1

    oijasoidu172hjn
    Joined:
    Feb 22, 2018
    Posts:
    102
    Reputation:
    0
    Thanks:
    53

    Objectmgr_fn

    it does the same as some AOE tutorials written here: Please Login/Register to view links
    but simpler and newbie friendly.

    Code:
    enum eObjectType //Credits to vaisefud3
    {
        PLAYER = 1,
        WEAPON = 3,
        GRENADE = 4,
        ZM_HEALTHBOX = 9,
        ZOMBIE = 10,
        MZ_GADGET = 23,
        BR_Items = 33
    };
    
    #define Objectmgr_fn 0x05F0480 //55 8B EC 51 89 4D FC 0F B7 45 08 8B 4D FC 3B ?? ?? ?? ?? ?? 73 29
    #define dw_ObjMgr 0x01155754 //A1 ?? ?? ?? ?? 83 B8 ?? ?? ?? ?? ?? 75 04 32 C0 EB 28 8B 4D 0C 51 8B 55 08
    
    typedef unsigned int(__thiscall* ObjectMgrFn)(DWORD ecx, uint16_t a2);
    
    ModelInstance* GetInstancesByIndex(uint16_t a2) {
        static auto BlablaFunction = (ObjectMgrFn)(Objectmgr_fn);
        auto ptr = *(DWORD*)(dw_ObjMgr);
        if (Helper::isBadPointer(ptr)) return 0; //Pointer checks are too important please don't disregard them.
        auto hObj = reinterpret_cast<ModelInstance*>(BlablaFunction(ptr, a2)); //this is where you get the Instance of an Object.
        if (Helper::isBadPointer(hObj)) return 0; //Pointer checks are too important please don't disregard them.
        return hObj;
    }
    
    void asda(){
        auto ptr = *(DWORD*)(dw_ObjMgr);
        if (Helper::isBadPointer(ptr)) return; //Pointer checks are too important please don't disregard them.
     
        auto ObjCount = *(DWORD*)(ptr + 0xA18);
        if (ObjCount < 0) return;
     
        for (uint16_t i = 0; i < ObjCount; i++) {
            auto HAHA_IM_AN_INSTANCE = GetInstancesByIndex(i);
    
            //your job to filter it to get the ZA Instance.
        }
    }
    
    --- Last post, May 29, 2020, Original Post Date: May 29, 2020 ---
    Sorry, wrong section. Please move it. /okay
     
    ImProHax, Jaymike Mods and JMAAAA thanks this.
    • BE A GAMER - RAMLeague
  2. Member Lvl2

    Davinci Junior the MXVIII
    Joined:
    Mar 23, 2016
    Gender:
    Male
    Posts:
    862
    Reputation:
    225
    Thanks:
    250
    Location:
    Locating...
    Angelic
    can i ask if there's a link to a CPlayer class from the PlayerObject? Tried it though but only to ObjectFX.
     
  3. oijasoidu172hjn Adict Gamer
    Member Lvl1

    oijasoidu172hjn
    Joined:
    Feb 22, 2018
    Posts:
    102
    Reputation:
    0
    Thanks:
    53
    I don't fully understand what you meant.
    By PlayerObject, you mean CharacterFx or LTObject/ModelInstance/hObj?
     
    Last edited: May 29, 2020
  4. Member Lvl2

    Davinci Junior the MXVIII
    Joined:
    Mar 23, 2016
    Gender:
    Male
    Posts:
    862
    Reputation:
    225
    Thanks:
    250
    Location:
    Locating...
    Angelic
    CPlayer class where name, hp, teamid.. located.

    PlayerObject is from the OBjectMgr ex: PlayerObject->CplyerClass or PlayerObject->ModelInstance->CplyerClass
     
  5. oijasoidu172hjn Adict Gamer
    Member Lvl1

    oijasoidu172hjn
    Joined:
    Feb 22, 2018
    Posts:
    102
    Reputation:
    0
    Thanks:
    53
    From what I've seen tho, CPlayer is in ClientShell and I don't think you can find a pointer to go back to CPlayerClass once you go in LTObject or CharacterFx.

    Tho you can always play around from modelinstance to characterfx.

    What are you trying to achieve anyways?
     
  6. Member Lvl2

    Davinci Junior the MXVIII
    Joined:
    Mar 23, 2016
    Gender:
    Male
    Posts:
    862
    Reputation:
    225
    Thanks:
    250
    Location:
    Locating...
    Angelic
    get the player name, hp, teamid from the Object?
     
  7. oijasoidu172hjn Adict Gamer
    Member Lvl1

    oijasoidu172hjn
    Joined:
    Feb 22, 2018
    Posts:
    102
    Reputation:
    0
    Thanks:
    53
    Bro it's in ClientShell.

    *(DWORD*)(0x1176558 + 20) == clientshell

    //0x1176558 is in CF.EXE Module.

    Code:
    class PlayerStruct //or CPlayer or PlayerObject or whatever
    {
    public:
        char pad_0000[4]; //0x0000
        class ModelInstance* LTObject; //0x0004
        uint8_t index; //0x0008
        uint8_t Team; //0x0009
        char PlayerName[14]; //0x000A
        class CObjectFX* CharacFX; //0x0018
        char pad_001C[8]; //0x001C
        bool hasC4; //0x0024
        char pad_0025[7]; //0x0025
        uint16_t RankID; //0x002C
        char pad_002E[18]; //0x002E
        uint16_t Health; //0x0040
        uint16_t Kills; //0x0042
    public:
        bool IsValidPlayer();
    }; //Size: 0x0048
    
    PlayerStruct* CLTClientShell::GetPlayer(int8_t PlayerID) {
        //pointer *this is == *(DWORD*)(0x1176558 + 20)
    
        if (Helper::isBadPointer(this)) return 0;
        if (PlayerID == -1) return 0; //tho it can't be -1 because i used unsigned int above /ahah
    
        return reinterpret_cast<PlayerStruct*>(this + 0x1FC + (PlayerID * 0xD80));
    }
    
     
  8. Member Lvl2

    Davinci Junior the MXVIII
    Joined:
    Mar 23, 2016
    Gender:
    Male
    Posts:
    862
    Reputation:
    225
    Thanks:
    250
    Location:
    Locating...
    Angelic
    Yah i know. What i asked is CPlayer link to another class like ModeInstance, ObjectFX or etc. So i can use ObjectMgr instead of ClientShell.
     
  9. oijasoidu172hjn Adict Gamer
    Member Lvl1

    oijasoidu172hjn
    Joined:
    Feb 22, 2018
    Posts:
    102
    Reputation:
    0
    Thanks:
    53
    oh sorry, yeah i've thought of that too but I don't think there's a link between them. Idk maybe some pro coders know a way.
     
  10. ImProHax Adict Gamer
    Member Lvl1

    ImProHax
    Joined:
    May 24, 2020
    Gender:
    Male
    Posts:
    124
    Reputation:
    0
    Thanks:
    7
    Angelic

    WHEN DID U UPDATE THE CFPH CHEAT ???
     
  11. hackX10 True God Gamer
    Member Lvl2

    hackX10
    Joined:
    Jun 14, 2018
    Gender:
    Male
    Posts:
    719
    Reputation:
    138
    Thanks:
    90
    Drunk
    gervin.jovlhyn@gmail.com
    gervin.coronado.15
    seym lang bayung
    isBadPointer saka isBadReadPtr ?
     
  12. oijasoidu172hjn Adict Gamer
    Member Lvl1

    oijasoidu172hjn
    Joined:
    Feb 22, 2018
    Posts:
    102
    Reputation:
    0
    Thanks:
    53
    isBadReadPtr is in windows function? idk i'm guessing but yeah.
    the isbadpointer in there (my post) is the function i improvised based on AOE's codes.

    it's like this

    Code:
    bool isbadpointer(void* asd){
        if(asd == 0) return true; //true because it's a bad pointer
        if(isBadReadPtr(asd, 4)) return true;
        //and so other checks.
    
        return false; //nope it's not a bad pointer and you can use it.
    }
    
    bool isbadpointer(DWORD asd){
        if(asd == 0) return true;
        if(isBadReadPtr(reinterpred_cast<void*>(asd), 4)) return true;
        //and so other checks.
    
        return false;
    }
    
     
    hackX10 thanks this.
  13. Jue RAML Expert
    Member Lvl2

    Jue
    Joined:
    Sep 4, 2016
    Gender:
    Male
    Posts:
    1,127
    Reputation:
    47
    Thanks:
    83
    Location:
    Cebu
    Flirty
    Philippines
    You got discord mate?
    --- Last post, May 31, 2020, Original Post Date: May 30, 2020 ---
    We are thinking the same thing but sadly no evidence of it for now haha
     

Tags for this Thread

:

Share This Page