[0.3.7 R5] CRemotePlayer::m_pGamePed жуть страшно

juki

Участник
Автор темы
62
12
я в шоке честно, сижу не могу понять в чем шутка

вот что выводит 1 player:04C36238 ped:00000004 game_ped:

C++:
for (auto i = 0; i < c_player_pool::MAX_PLAYERS; ++i) {
    c_player_pool *player_pool = c_netgame::get()->ref()->get_player_pool();
    if (player_pool->local_info.id == i || !player_pool->get_player(i)) continue;

    c_remote_player *player = player_pool->get_player(i);
    if (!player->does_exist()) continue;

    std::cout << i << " player:" << player << " ped:" << player->ped << " game_ped:" << player->ped->game_ped << std::endl;

    float* position = (float*)(*(uint32_t*)(player->ped->game_ped + 0x14) + 0x30);

    std::cout << i << " X:" << position[0] << " Y:" << position[1] << " Z:" << position[3] << std::endl;
}
C++:
class c_entity {

public:

    char pad_4[60];
    ::c_entity* game_entity;
    int handle;

    int get_model_index() {
        return ((int(__thiscall*)(c_entity*)) rakhook::samp_addr(offsets::entity::get_model_index[VERSION]))(this);
    }

    c_entity* teleport(float pos[3]) {
        return ((c_entity*(__thiscall*)(c_entity*, float[3])) rakhook::samp_addr(offsets::entity::teleport[VERSION]))(this, pos);
    }
};


class c_ped : public c_entity {

public:

    enum { MAX_ACCESSORIES = 10 };

    struct accessory {
        int model;
        int bone;
        float offset[3];
        float rotation[3];
        float scale[3];
        unsigned long first_material_color;
        unsigned long second_material_color;
    };

    enum stuff_type {
        STUFF_TYPE_NONE,
        STUFF_TYPE_BEER,
        STUFF_TYPE_DYN_BEER,
        STUFF_TYPE_PINT_GLASS,
        STUFF_TYPE_CIGGI
    };

    BOOL using_cellphone;

    struct {
        BOOL not_empty[MAX_ACCESSORIES];
        accessory info[MAX_ACCESSORIES];
        class CObject* object[MAX_ACCESSORIES];
    } accessories;

    ::c_ped* game_ped;
    int pad_2a8[2];
    unsigned char player_number;
    int pad_2b1[2];
    int parachute_object;
    int urinating_particle;

    struct {
        int type;
        int object;
        int drunk_level;
    } stuff;

    int arrow;
    char field_2de;
    BOOL is_dancing;
    int dance_style;
    int last_dance_move;
    char pad_2de[20];
    BOOL is_urinating;
    char pad[55];
};


class c_remote_player {

public:

    enum player_state {
        PLAYER_STATE_NONE,
        PLAYER_STATE_ONFOOT = 17,
        PLAYER_STATE_DRIVER = 19,
        PLAYER_STATE_PASSENGER = 18,
        PLAYER_STATE_WASTED = 32,
        PLAYER_STATE_SPAWNED = 33
    };

    enum update_type {
        UPDATE_TYPE_NONE,
        UPDATE_TYPE_ONFOOT = 16,
        UPDATE_TYPE_DRIVER = 17,
        UPDATE_TYPE_PASSENGER = 18,
    };

    enum player_status { PLAYER_STATUS_TIMEOUT = 2 };
    
    char field_1[0x1DD];
    c_ped* ped;
    void* vehicle;

    void set_marker_state(int state) {
        ((void(__thiscall*)(c_remote_player*, BOOL)) rakhook::samp_addr(offsets::remote_player::set_marker_state[VERSION]) )(this, state);
    }

    int does_exist() {
        return ((int(__thiscall*)(c_remote_player*)) rakhook::samp_addr(offsets::remote_player::does_exists[VERSION]) )(this);
    }

    unsigned long get_color_as_argb() {
        return ((unsigned long(__thiscall*)(c_remote_player*)) rakhook::samp_addr(offsets::remote_player::get_color_as_argb[VERSION]) )(this);
    }
};
 
Последнее редактирование:

juki

Участник
Автор темы
62
12
1 player:76754368 ped:4294535424 game_ped:

решил через костыль
C++:
for (auto i = 0; i < c_player_pool::MAX_PLAYERS; ++i) {
    auto player_pool = c_netgame::get()->ref()->get_player_pool();
    if (player_pool->local_info.id == i || !player_pool->get_player(i)) continue;

    auto player = player_pool->get_player(i);
    if (!player->does_exist()) continue;

    auto ped = *(void**)((uint32_t)player + 0x1DD);
    auto game_ped = *(void**)((uint32_t)ped + 0x2A4);

    std::cout << i << " player:" << player << " ped:" << ped << " game_ped:" << game_ped << std::endl;

    auto position = (float*)(*(uint32_t*)((uint32_t)game_ped + 0x14) + 0x30);

    std::cout << i << " X:" << position[0] << " Y:" << position[1] << " Z:" << position[2] << std::endl;
}
 
Последнее редактирование: