mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 19:38:25 +00:00
stop spawning in the ground / hook CGameRules::IsSpawnPointValid()
This commit is contained in:
parent
1531d65f3c
commit
9db01e2eb5
@ -37,6 +37,12 @@
|
|||||||
"linux" "506"
|
"linux" "506"
|
||||||
"mac" "506"
|
"mac" "506"
|
||||||
}
|
}
|
||||||
|
"CGameRules::IsSpawnPointValid"
|
||||||
|
{
|
||||||
|
"windows" "77"
|
||||||
|
"linux" "78"
|
||||||
|
"mac" "78"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +56,12 @@
|
|||||||
"linux" "439"
|
"linux" "439"
|
||||||
"mac" "439"
|
"mac" "439"
|
||||||
}
|
}
|
||||||
|
"CGameRules::IsSpawnPointValid"
|
||||||
|
{
|
||||||
|
"windows" "76"
|
||||||
|
"linux" "77"
|
||||||
|
"mac" "77"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,6 +161,7 @@ Handle gH_Forwards_OnCheckpointMenuSelect = null;
|
|||||||
|
|
||||||
// dhooks
|
// dhooks
|
||||||
Handle gH_GetPlayerMaxSpeed = null;
|
Handle gH_GetPlayerMaxSpeed = null;
|
||||||
|
DynamicHook gH_IsSpawnPointValid = null;
|
||||||
|
|
||||||
// modules
|
// modules
|
||||||
bool gB_Eventqueuefix = false;
|
bool gB_Eventqueuefix = false;
|
||||||
@ -362,11 +363,21 @@ public void OnPluginStart()
|
|||||||
{
|
{
|
||||||
gH_GetPlayerMaxSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, CCSPlayer__GetPlayerMaxSpeed);
|
gH_GetPlayerMaxSpeed = DHookCreate(iOffset, HookType_Entity, ReturnType_Float, ThisPointer_CBaseEntity, CCSPlayer__GetPlayerMaxSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetFailState("Couldn't get the offset for \"CCSPlayer::GetPlayerMaxSpeed\" - make sure your gamedata is updated!");
|
SetFailState("Couldn't get the offset for \"CCSPlayer::GetPlayerMaxSpeed\" - make sure your gamedata is updated!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((iOffset = GameConfGetOffset(hGameData, "CGameRules::IsSpawnPointValid")) != -1)
|
||||||
|
{
|
||||||
|
gH_IsSpawnPointValid = new DynamicHook(iOffset, HookType_GameRules, ReturnType_Bool, ThisPointer_Ignore);
|
||||||
|
gH_IsSpawnPointValid.AddParam(HookParamType_CBaseEntity);
|
||||||
|
gH_IsSpawnPointValid.AddParam(HookParamType_CBaseEntity);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SetFailState("Couldn't get the offset for \"CGameRules::IsSpawnPointValid\" - make sure your gamedata is updated!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete hGameData;
|
delete hGameData;
|
||||||
@ -398,6 +409,17 @@ public void OnPluginStart()
|
|||||||
gB_Chat = LibraryExists("shavit-chat");
|
gB_Chat = LibraryExists("shavit-chat");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MRESReturn Detour_IsSpawnPointValid(Handle hReturn, Handle hParams)
|
||||||
|
{
|
||||||
|
if (gCV_NoBlock.BoolValue)
|
||||||
|
{
|
||||||
|
DHookSetReturn(hReturn, true);
|
||||||
|
return MRES_Supercede;
|
||||||
|
}
|
||||||
|
|
||||||
|
return MRES_Ignored;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnClientCookiesCached(int client)
|
public void OnClientCookiesCached(int client)
|
||||||
{
|
{
|
||||||
if(IsFakeClient(client))
|
if(IsFakeClient(client))
|
||||||
@ -506,6 +528,11 @@ public void OnConfigsExecuted()
|
|||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
|
if (gH_IsSpawnPointValid != null)
|
||||||
|
{
|
||||||
|
gH_IsSpawnPointValid.HookGamerules(Hook_Post, Detour_IsSpawnPointValid);
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 1; i <= MaxClients; i++)
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
{
|
{
|
||||||
ResetCheckpoints(i);
|
ResetCheckpoints(i);
|
||||||
@ -535,8 +562,9 @@ public void OnMapStart()
|
|||||||
(iEntity = FindEntityByClassname(iEntity, "info_player_teamspawn")) != -1 || // TF2 spawn point
|
(iEntity = FindEntityByClassname(iEntity, "info_player_teamspawn")) != -1 || // TF2 spawn point
|
||||||
(iEntity = FindEntityByClassname(iEntity, "info_player_start")) != -1)
|
(iEntity = FindEntityByClassname(iEntity, "info_player_start")) != -1)
|
||||||
{
|
{
|
||||||
float fOrigin[3];
|
float fOrigin[3], fAngles[3];
|
||||||
GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fOrigin);
|
GetEntPropVector(iEntity, Prop_Send, "m_vecOrigin", fOrigin);
|
||||||
|
GetEntPropVector(iEntity, Prop_Data, "m_angAbsRotation", fAngles);
|
||||||
|
|
||||||
for(int i = 1; i <= gCV_CreateSpawnPoints.IntValue; i++)
|
for(int i = 1; i <= gCV_CreateSpawnPoints.IntValue; i++)
|
||||||
{
|
{
|
||||||
@ -546,7 +574,7 @@ public void OnMapStart()
|
|||||||
|
|
||||||
if(DispatchSpawn(iSpawnPoint))
|
if(DispatchSpawn(iSpawnPoint))
|
||||||
{
|
{
|
||||||
TeleportEntity(iSpawnPoint, fOrigin, view_as<float>({0.0, 0.0, 0.0}), NULL_VECTOR);
|
TeleportEntity(iSpawnPoint, fOrigin, fAngles, NULL_VECTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user