Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #47 from marqdevx/marqdevx/admins-cfg
Browse files Browse the repository at this point in the history
Small fixes + cs2 update fix
  • Loading branch information
marqdevx authored Mar 14, 2024
2 parents 76509f6 + e4d6fb9 commit 9fe3edc
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 47 deletions.
2 changes: 1 addition & 1 deletion configs/admins.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Admins
{
"name" // can be anything
{
"steamid" "1234567890" // steamid64
"steam" "1234567890" // steamid64
"flags" "abcdefg" // permission flags, same as sourcemod with z being everything
}
}
55 changes: 36 additions & 19 deletions gamedata/cs2fixes.games.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,6 @@
"windows" "\x40\x53\x48\x83\xEC\x20\x48\x8B\xD9\x3B\x91\xD0\x00\x00\x00"
"linux" "\x55\x48\x89\xE5\x41\x55\x41\x54\x53\x48\x89\xFB\x48\x83\xEC\x08\x3B\xB7\xE0\x00\x00\x00"
}
// String: "Playing sound on non-networked entity %s"
"CSoundEmitterSystem_EmitSound"
{
"library" "server"
"windows" "\x48\x8B\xC4\x4C\x89\x40\x18\x55\x57"
"linux" "\x48\xB8\x2A\x2A\x2A\x2A\xFF\xFF\xFF\xFF\x55\x48\x89\xE5\x41\x57\x41\x89\xF7"
}
// idk a good way to find this again, i just brute forced the vtable. offset is 133 on CTriggerPush
"TriggerPush_Touch"
{
Expand Down Expand Up @@ -326,20 +319,37 @@
"linux" "\x48\x85\xF6\x74\x2A\x48\x8B\x47\x10\xF6\x40\x31\x02\x75\x2A\x48\x8B\x46\x10\xF6\x40\x31\x02\x75\x2A\xB8\x2A\x2A\x2A\x2A"
}

// "CNetChan::SendNetMessage"
"SendNetMessage"
// "Attempted to find unknown particle system \"%s\"\n"
"GetParticleSystemIndex"
{
"library" "networksystem"
"windows" "\x48\x89\x5C\x24\x10\x48\x89\x6C\x24\x18\x48\x89\x74\x24\x20\x57\x41\x56\x41\x57\x48\x83\xEC\x40\x49\x8B\xE8"
"linux" "\x55\x48\x89\xE5\x41\x57\x41\x89\xCF\x41\x56\x4C\x8D\xB7\x90\x76\x00\x00"
"library" "server"
"windows" "\x48\x89\x5C\x24\x08\x48\x89\x74\x24\x10\x57\x48\x81\xEC\x00\x01\x00\x00\x48\x8B\xF2\x48\x8B\xF9"
"linux" "\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x49\x89\xFD\x41\x54\x48\x81\xEC\xE0\x00\x00\x00"
}

// "Discarding pending request"
"HostStateRequest"
// "ParticleEffect", found in a function with 9 arguments
"DispatchParticleEffect"
{
"library" "server"
"windows" "\x48\x89\x5C\x24\x10\x48\x89\x74\x24\x18\x55\x57\x41\x56\x48\x8D\x6C\x24\xE1"
"linux" "\x55\x48\x89\xE5\x41\x57\x41\x56\x49\x89\xFE\x41\x55\x45\x89\xCD\x41\x54\x49\x89\xD4\x53\x89\xCB\x48\x81\xEC\x2A\x2A\x2A\x2A"
}

// search for "land_%s", this is called after that string is referenced (the one with 4 parameters).
// (function that calls it also contains "T_Default.SuitLand").
"CBaseEntity_EmitSoundFilter"
{
"library" "server"
"windows" "\x48\x89\x5C\x24\x08\x48\x89\x6C\x24\x10\x48\x89\x74\x24\x18\x48\x89\x7C\x24\x20\x41\x56\x48\x83\xEC\x30\x48\x8B\xF9"
"linux" "\x55\x48\x89\xE5\x41\x57\x41\x56\x49\x89\xD6\x41\x55\x41\x89\xF5\x41\x54\x49\x89\xFC\x53\x48\x83\xEC\x2A\x48"
}

// "CNetworkStringTable::AddString"
"CNetworkStringTable_AddString"
{
"library" "engine"
"windows" "\x48\x89\x74\x24\x10\x57\x48\x83\xEC\x30\x33\xF6\x48\x8B\xFA"
"linux" "\x55\x48\x89\xE5\x41\x56\x41\x55\x41\x54\x49\x89\xF4\x53\x48\x83\x7F\x30\x00"
"windows" "\x48\x89\x5C\x24\x2A\x55\x56\x57\x48\x83\xEC\x60\x80\x79\x44\x02\x49\x8B\xF9"
"linux" "\x55\x48\x89\xE5\x41\x57\x41\x56\x41\x55\x49\x89\xCD\x41\x54\x49\x89\xFC\x53\x89\xF3\x48\x83\xEC\x28\x80\x7F\x3C\x01"
}
}
"Offsets"
Expand Down Expand Up @@ -414,13 +424,20 @@
"windows" "584"
"linux" "584"
}

// "tried to sprint to a non-client", there will be a check above like this: if ( a2 >= *(v5 + 632) )
// engine
// "tried to sprint to a non-client", there will be a check above like this: if ( a2 >= *(v5 + 632) ), note that this is a CUtlVector
"CNetworkGameServer_ClientList"
{
"windows" "77"
"linux" "79"
}

// Called right before printing "Warning: Can't add nullptr string to table %s\n"
"CNetworkStringTable_GetTableName"
{
"windows" "1"
"linux" "2"
}
}
"Patches"
{
Expand Down Expand Up @@ -470,4 +487,4 @@
}
}
}
}
}
27 changes: 12 additions & 15 deletions src/commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,36 +402,33 @@ CON_COMMAND_CHAT(pause, "Request pause")
if (!player)
return;

int iPlayer = player->GetPlayerSlot();
if(match_paused) {
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX" Match already paused");
return;
}

CBasePlayerController* pPlayer = (CBasePlayerController*)g_pEntitySystem->GetBaseEntity((CEntityIndex)(player->GetPlayerSlot() + 1));
match_paused = true;

g_pEngineServer2->ServerCommand("mp_pause_match");

ClientPrintAll(HUD_PRINTTALK, CHAT_PREFIX"\4%s \1requested a pause", player->GetPlayerName());

match_paused = true;
ct_ready = false;
t_ready = false;
}

CON_COMMAND_CHAT(unpause, "Request unpause")
{
if(!g_bEnablePause)
if(!g_bEnablePause || !player)
return;

if (!player)
if (!match_paused){
ClientPrint(player, HUD_PRINTTALK, CHAT_PREFIX"Match is not paused yet, type \5 .pause");
return;
}

if(!match_paused)
return;

CBasePlayerController* pPlayer = (CBasePlayerController*)g_pEntitySystem->GetBaseEntity((CEntityIndex)(player->GetPlayerSlot() + 1));

int teamSide = pPlayer->m_iTeamNum();
if( teamSide == CS_TEAM_T && !t_ready){
int teamSide = player->m_iTeamNum();
if(teamSide == CS_TEAM_T && !t_ready){
t_ready = true;
}else if( teamSide == CS_TEAM_CT && !ct_ready){
}else if(teamSide == CS_TEAM_CT && !ct_ready){
ct_ready = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/cs2fixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ const char *CS2Fixes::GetLicense()

const char *CS2Fixes::GetVersion()
{
return "1.1.0";
return "1.1.1";
}

const char *CS2Fixes::GetDate()
Expand Down
11 changes: 0 additions & 11 deletions src/detours.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ extern CCSGameRules *g_pGameRules;
DECLARE_DETOUR(UTIL_SayTextFilter, Detour_UTIL_SayTextFilter);
DECLARE_DETOUR(UTIL_SayText2Filter, Detour_UTIL_SayText2Filter);
//DECLARE_DETOUR(IsHearingClient, Detour_IsHearingClient);
DECLARE_DETOUR(CSoundEmitterSystem_EmitSound, Detour_CSoundEmitterSystem_EmitSound);
//DECLARE_DETOUR(TriggerPush_Touch, Detour_TriggerPush_Touch);
DECLARE_DETOUR(CGameRules_Constructor, Detour_CGameRules_Constructor);
//DECLARE_DETOUR(CBaseEntity_TakeDamageOld, Detour_CBaseEntity_TakeDamageOld);
Expand All @@ -72,12 +71,6 @@ static bool g_bBlockAllDamage = false;
FAKE_BOOL_CVAR(cs2f_block_molotov_self_dmg, "Whether to block self-damage from molotovs", g_bBlockMolotovSelfDmg, false, false)
FAKE_BOOL_CVAR(cs2f_block_all_dmg, "Whether to block all damage to players", g_bBlockAllDamage, false, false)

void FASTCALL Detour_CSoundEmitterSystem_EmitSound(ISoundEmitterSystemBase *pSoundEmitterSystem, CEntityIndex *a2, IRecipientFilter &filter, uint32 a4, void *a5)
{
//ConMsg("Detour_CSoundEmitterSystem_EmitSound\n");
CSoundEmitterSystem_EmitSound(pSoundEmitterSystem, a2, filter, a4, a5);
}


void SayChatMessageWithTimer(IRecipientFilter &filter, const char *pText, CCSPlayerController *pPlayer, uint64 eMessageType)
{
Expand Down Expand Up @@ -289,10 +282,6 @@ bool InitDetours(CGameConfig *gameConfig)
success = false;
UTIL_SayText2Filter.EnableDetour();

if (!CSoundEmitterSystem_EmitSound.CreateDetour(gameConfig))
success = false;
CSoundEmitterSystem_EmitSound.EnableDetour();

if (!CGameRules_Constructor.CreateDetour(gameConfig))
success = false;
CGameRules_Constructor.EnableDetour();
Expand Down

0 comments on commit 9fe3edc

Please sign in to comment.