-
Автор темы
- #1
как можно получить стейт локалплеера например жив он или нет, подключился он или нет?
enum DOTA_GameState : int {
DOTA_GAMERULES_STATE_INIT = 0,
DOTA_GAMERULES_STATE_WAIT_FOR_PLAYERS_TO_LOAD = 1,
DOTA_GAMERULES_STATE_HERO_SELECTION = 2,
DOTA_GAMERULES_STATE_STRATEGY_TIME = 3,
DOTA_GAMERULES_STATE_PRE_GAME = 4,
DOTA_GAMERULES_STATE_GAME_IN_PROGRESS = 5,
DOTA_GAMERULES_STATE_POST_GAME = 6,
DOTA_GAMERULES_STATE_DISCONNECT = 7,
DOTA_GAMERULES_STATE_TEAM_SHOWCASE = 8,
DOTA_GAMERULES_STATE_CUSTOM_GAME_SETUP = 9,
DOTA_GAMERULES_STATE_WAIT_FOR_MAP_TO_LOAD = 10,
DOTA_GAMERULES_STATE_SCENARIO_SETUP = 11,
DOTA_GAMERULES_STATE_LAST = 12
};
class CDOTAGameRules {
public:
DOTA_GameState GameState() {
uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_nGameState);
return *(DOTA_GameState*)Addr;
}
}
/////////////////////
class CEngineClient {
public:
bool IsInGame() {
typedef bool (*Fn)(void*);
return Memory::GetVFunc<Fn>(this, 25)(this);
}
}
// Алсо, можно хукнуть FireEventClientSide и ловить ивент "player_connect_full" или "dota_game_state_change"
bool hkFireEventClientSide(CGameEventManager * thisptr, CGameEvent * event) {
if (!strcmp(eventName, "dota_game_state_change")) {
DOTA_GameState GameState = (DOTA_GameState)event->GetInt("new_state", -1);
if (GameState == DOTA_GAMERULES_STATE_HERO_SELECTION) {
// Тут твоя логика
}
}
// Класс
class CGameEvent {
public: const char* GetName() {
typedef const char* (*Fn)(void *);
return Memory::GetVFunc<Fn>(this, 1)(this);
}
int GetID() {
typedef int(* Fn)(void *);
return Memory::GetVFunc<Fn> (this, 2)(this);
}
bool GetBool(char const* keyname, bool defaultValue) {
typedef bool(*Fn)(void* , char const* , bool);
return Memory::GetVFunc<Fn>(this, 6)(this, keyname, defaultValue);
}
int GetInt(char const* keyname, int defaultValue) {
typedef int(*Fn)(void* , char const* , int);
return Memory::GetVFunc<Fn>(this, 7)(this, keyname, defaultValue);
}
uint64_t GetUint64(char const* keyname, uint64_t defaultValue) {
typedef uint64_t(*Fn)(void* , char const* , uint64_t);
return Memory::GetVFunc<Fn>(this, 8)(this, keyname, defaultValue);
}
float GetFloat(char const* keyname, float defaultValue) {
typedef float(*Fn)(void* , char const* , float);
return Memory::GetVFunc<Fn>(this, 9)(this, keyname, defaultValue);
}
const char* GetString(char const* keyname, char * defaultValue) {
typedef const char* (*Fn)(void* , char const* , char const* );
return Memory::GetVFunc<Fn>(this, 10)(this, keyname, defaultValue);
}
const void * GetPtr(char const* keyname) {
typedef void*(*Fn)(void*, char const*);
return Memory::GetVFunc<Fn>(this, 11)(this, keyname);
}
};
(олд код все дела блаблабла - не тебе так другим пригодится; в общем так к слову, на будущее)C++:enum DOTA_GameState : int { DOTA_GAMERULES_STATE_INIT = 0, DOTA_GAMERULES_STATE_WAIT_FOR_PLAYERS_TO_LOAD = 1, DOTA_GAMERULES_STATE_HERO_SELECTION = 2, DOTA_GAMERULES_STATE_STRATEGY_TIME = 3, DOTA_GAMERULES_STATE_PRE_GAME = 4, DOTA_GAMERULES_STATE_GAME_IN_PROGRESS = 5, DOTA_GAMERULES_STATE_POST_GAME = 6, DOTA_GAMERULES_STATE_DISCONNECT = 7, DOTA_GAMERULES_STATE_TEAM_SHOWCASE = 8, DOTA_GAMERULES_STATE_CUSTOM_GAME_SETUP = 9, DOTA_GAMERULES_STATE_WAIT_FOR_MAP_TO_LOAD = 10, DOTA_GAMERULES_STATE_SCENARIO_SETUP = 11, DOTA_GAMERULES_STATE_LAST = 12 }; class CDOTAGameRules { public: DOTA_GameState GameState() { uintptr_t Addr = ((uintptr_t)this + Netvars::Offsets.m_nGameState); return *(DOTA_GameState*)Addr; } } ///////////////////// class CEngineClient { public: bool IsInGame() { typedef bool (*Fn)(void*); return Memory::GetVFunc<Fn>(this, 25)(this); } } // Алсо, можно хукнуть FireEventClientSide и ловить ивент "player_connect_full" или "dota_game_state_change" bool hkFireEventClientSide(CGameEventManager * thisptr, CGameEvent * event) { if (!strcmp(eventName, "dota_game_state_change")) { DOTA_GameState GameState = (DOTA_GameState)event->GetInt("new_state", -1); if (GameState == DOTA_GAMERULES_STATE_HERO_SELECTION) { // Тут твоя логика } } // Класс class CGameEvent { public: const char* GetName() { typedef const char* (*Fn)(void *); return Memory::GetVFunc<Fn>(this, 1)(this); } int GetID() { typedef int(* Fn)(void *); return Memory::GetVFunc<Fn> (this, 2)(this); } bool GetBool(char const* keyname, bool defaultValue) { typedef bool(*Fn)(void* , char const* , bool); return Memory::GetVFunc<Fn>(this, 6)(this, keyname, defaultValue); } int GetInt(char const* keyname, int defaultValue) { typedef int(*Fn)(void* , char const* , int); return Memory::GetVFunc<Fn>(this, 7)(this, keyname, defaultValue); } uint64_t GetUint64(char const* keyname, uint64_t defaultValue) { typedef uint64_t(*Fn)(void* , char const* , uint64_t); return Memory::GetVFunc<Fn>(this, 8)(this, keyname, defaultValue); } float GetFloat(char const* keyname, float defaultValue) { typedef float(*Fn)(void* , char const* , float); return Memory::GetVFunc<Fn>(this, 9)(this, keyname, defaultValue); } const char* GetString(char const* keyname, char * defaultValue) { typedef const char* (*Fn)(void* , char const* , char const* ); return Memory::GetVFunc<Fn>(this, 10)(this, keyname, defaultValue); } const void * GetPtr(char const* keyname) { typedef void*(*Fn)(void*, char const*); return Memory::GetVFunc<Fn>(this, 11)(this, keyname); } };
typedef void*(*Fn)(void*, char const*);
using Fn = void*(*)(void*, char const*);
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz