mirror of
https://github.com/rumourA/End-Touch-Fix.git
synced 2025-12-07 10:38:25 +00:00
Init
This commit is contained in:
commit
16f2dd7cc6
51
gamedata/endtouch.games.txt
Normal file
51
gamedata/endtouch.games.txt
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
"Games"
|
||||||
|
{
|
||||||
|
"#default"
|
||||||
|
{
|
||||||
|
"Addresses"
|
||||||
|
{
|
||||||
|
"PhysicsMarkEntityAsTouchedAddress"
|
||||||
|
{
|
||||||
|
"windows"
|
||||||
|
{
|
||||||
|
"signature" "PhysicsMarkEntityAsTouched"
|
||||||
|
}
|
||||||
|
|
||||||
|
"linux"
|
||||||
|
{
|
||||||
|
"signature" "PhysicsMarkEntityAsTouched"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"Signatures"
|
||||||
|
{
|
||||||
|
"PhysicsCheckForEntityUntouch"
|
||||||
|
{
|
||||||
|
"windows" "\x55\x8B\xEC\x51\x56\x8B\xF1\x8B\x86\x38\x03\x00\x00"
|
||||||
|
"linux" "@_ZN11CBaseEntity28PhysicsCheckForEntityUntouchEv"
|
||||||
|
}
|
||||||
|
|
||||||
|
"PhysicsMarkEntityAsTouched"
|
||||||
|
{
|
||||||
|
"windows" "\x55\x8B\xEC\x53\x8B\x5D\x08\x56\x8B\xF1\x3B\xF3"
|
||||||
|
"linux" "@_ZN11CBaseEntity26PhysicsMarkEntityAsTouchedEPS_"
|
||||||
|
}
|
||||||
|
|
||||||
|
"DisableTouchFuncs"
|
||||||
|
{
|
||||||
|
"windows" "\x80\x3D\x00\x00\x00\x00\x00\x75\x14\x53\x8B\xCE\xE8\x00\x00\x00\x00\x8B\xC7"
|
||||||
|
"linux" "@_ZN11CBaseEntity21sm_bDisableTouchFuncsE"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
"Offsets"
|
||||||
|
{
|
||||||
|
"OS"
|
||||||
|
{
|
||||||
|
"windows" "1"
|
||||||
|
"linux" "2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
102
scripting/BareTimer.sp
Normal file
102
scripting/BareTimer.sp
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
#include <sourcemod>
|
||||||
|
#include <sdktools>
|
||||||
|
#include <sdkhooks>
|
||||||
|
|
||||||
|
#pragma semicolon 1
|
||||||
|
|
||||||
|
#pragma newdecls required
|
||||||
|
|
||||||
|
float Time[MAXPLAYERS +1];
|
||||||
|
bool ShouldTime[MAXPLAYERS + 1];
|
||||||
|
bool LateLoad;
|
||||||
|
|
||||||
|
public Plugin myinfo =
|
||||||
|
{
|
||||||
|
name = "Barebones Timer",
|
||||||
|
author = "rumour",
|
||||||
|
description = "This is just a very simple example to use with the EndTouchFix and does not account for tick fraction",
|
||||||
|
version = "",
|
||||||
|
url = ""
|
||||||
|
};
|
||||||
|
|
||||||
|
public void OnPluginStart()
|
||||||
|
{
|
||||||
|
if(LateLoad)
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i))
|
||||||
|
{
|
||||||
|
OnClientPutInServer(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int triggers = 0;
|
||||||
|
while ((triggers = FindEntityByClassname(triggers, "trigger_multiple")) != -1)
|
||||||
|
{
|
||||||
|
SDKHook(triggers, SDKHook_StartTouch, Zone_StartTouch);
|
||||||
|
SDKHook(triggers, SDKHook_EndTouch, Zone_EndTouch);
|
||||||
|
}
|
||||||
|
LateLoad = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||||
|
{
|
||||||
|
LateLoad = late;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClientPutInServer(int client)
|
||||||
|
{
|
||||||
|
SDKHook(client, SDKHook_PostThinkPost, PostThinkPost);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnEntityCreated(int entity, const char[] classname)
|
||||||
|
{
|
||||||
|
if(StrContains(classname, "trigger_") != -1)
|
||||||
|
{
|
||||||
|
SDKHook(entity, SDKHook_StartTouch, Zone_StartTouch);
|
||||||
|
SDKHook(entity, SDKHook_EndTouch, Zone_EndTouch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Zone_StartTouch(int entity, int other)
|
||||||
|
{
|
||||||
|
char trigger_name[255];
|
||||||
|
GetEntPropString(entity, Prop_Data, "m_iName", trigger_name, sizeof(trigger_name));
|
||||||
|
|
||||||
|
if(StrEqual(trigger_name, "timer_end"))
|
||||||
|
{
|
||||||
|
PrintToChat(other, "Hit End %f", Time[other]);
|
||||||
|
ShouldTime[other] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action Zone_EndTouch(int entity, int other)
|
||||||
|
{
|
||||||
|
char trigger_name[255];
|
||||||
|
GetEntPropString(entity, Prop_Data, "m_iName", trigger_name, sizeof(trigger_name));
|
||||||
|
|
||||||
|
if(StrEqual(trigger_name, "timer_start"))
|
||||||
|
{
|
||||||
|
PrintToChat(other, "Left Start");
|
||||||
|
ShouldTime[other] = true;
|
||||||
|
Time[other] = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action PostThinkPost(int client)
|
||||||
|
{
|
||||||
|
SetEntPropFloat(client, Prop_Send, "m_flStamina", 0.0);
|
||||||
|
|
||||||
|
if(ShouldTime[client])
|
||||||
|
{
|
||||||
|
Time[client] += GetTickInterval();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
99
scripting/EndTouchFix.sp
Normal file
99
scripting/EndTouchFix.sp
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
#include <sourcemod>
|
||||||
|
#include <sdktools>
|
||||||
|
#include <sdkhooks>
|
||||||
|
|
||||||
|
#pragma semicolon 1
|
||||||
|
|
||||||
|
#pragma newdecls required
|
||||||
|
|
||||||
|
#define EFL_CHECK_UNTOUCH (1<<24)
|
||||||
|
#define WINDOWS 1
|
||||||
|
|
||||||
|
Handle PhysicsCheckForEntityUntouch;
|
||||||
|
Address PhysicsMarkEntityAsTouched;
|
||||||
|
int OS;
|
||||||
|
bool LateLoad;
|
||||||
|
|
||||||
|
public Plugin myinfo =
|
||||||
|
{
|
||||||
|
name = "EndTouch Fix",
|
||||||
|
author = "rumour, mev",
|
||||||
|
description = "Checks EntityUntouch on PostThink instead of server frames",
|
||||||
|
version = "1.0",
|
||||||
|
url = ""
|
||||||
|
};
|
||||||
|
|
||||||
|
public void OnPluginStart()
|
||||||
|
{
|
||||||
|
GameData game_data = new GameData("endtouch.games");
|
||||||
|
|
||||||
|
if(game_data == null)
|
||||||
|
{
|
||||||
|
SetFailState("Failed to load game_data");
|
||||||
|
}
|
||||||
|
|
||||||
|
OS = game_data.GetOffset("OS");
|
||||||
|
|
||||||
|
PhysicsMarkEntityAsTouched = game_data.GetAddress("PhysicsMarkEntityAsTouchedAddress");
|
||||||
|
|
||||||
|
StartPrepSDKCall(SDKCall_Entity);
|
||||||
|
if(!PrepSDKCall_SetFromConf(game_data, SDKConf_Signature, "PhysicsCheckForEntityUntouch"))
|
||||||
|
{
|
||||||
|
SetFailState("Failed to get PhysicsCheckForEntityUntouch");
|
||||||
|
}
|
||||||
|
|
||||||
|
PhysicsCheckForEntityUntouch = EndPrepSDKCall();
|
||||||
|
|
||||||
|
delete game_data;
|
||||||
|
|
||||||
|
if(LateLoad)
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(i))
|
||||||
|
{
|
||||||
|
OnClientPutInServer(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
|
||||||
|
{
|
||||||
|
LateLoad = late;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnClientPutInServer(int client)
|
||||||
|
{
|
||||||
|
SDKHook(client, SDKHook_PostThink, PostThink);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetCheckUntouch(int client)
|
||||||
|
{
|
||||||
|
int flags = GetEntProp(client, Prop_Data, "m_iEFlags");
|
||||||
|
return (flags & EFL_CHECK_UNTOUCH) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action PostThink(int client)
|
||||||
|
{
|
||||||
|
int disable_touch_funcs;
|
||||||
|
|
||||||
|
if(OS == WINDOWS)
|
||||||
|
{
|
||||||
|
disable_touch_funcs = LoadFromAddress(PhysicsMarkEntityAsTouched + view_as<Address>(0x3430B2), NumberType_Int8);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
disable_touch_funcs = LoadFromAddress(PhysicsMarkEntityAsTouched + view_as<Address>(0x7E4064), NumberType_Int8);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!disable_touch_funcs)
|
||||||
|
{
|
||||||
|
if(GetCheckUntouch(client))
|
||||||
|
{
|
||||||
|
SDKCall(PhysicsCheckForEntityUntouch, client);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Continue;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user