|
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
|
02-07-2018
, 08:27
Re: [L4D2] SDKCall CCharge::MarkSurvivorAsHit crashes server
|
#3
|
Why not write the signatures in a .txt file and put in the gamedata folder instead of hardcoding it in the plugin?
ChargerInfiniteImpact.txt
PHP Code:
"Games"
{
"left4dead2"
{
"Signatures"
{
"ClearAllSurvivorHits"
{
"library" "server"
"linux" "@_ZN7CCharge20ClearAllSurvivorHitsEv"
}
// "MarkSurvivorAsHit" /*Not needed since it will just replicate the bug again. */
// {
// "library" "server"
// "linux" "@_ZN7CCharge17MarkSurvivorAsHitEi"
// }
}
}
}
For the code, do not use OnGameFrame when calling signatures since it applies them for every game frame.
Fixed source code:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
Handle hGamedata = null, hClearAllHits = null; /*, hMarkAsHit = null;*/
public Plugin myinfo =
{
name = "Charger infinite impacts",
author = "Eyal282 ( FuckTheSchool )",
description = "Chargers will no longer run in place if touching a survivor they already impacted",
version = "1.0",
url = "NULL"
};
public void OnPluginStart()
{
hGamedata = LoadGameConfigFile("ChargerInfiniteImpact");
if (hGamedata = null)
{
SetFailState("Game data is missing!");
}
StartPrepSDKCall(SDKCall_Entity);
PrepSDKCall_SetFromConf(hGamedata, SDKConf_Signature, "ClearAllSurvivorHits");
hClearAllHits = EndPrepSDKCall();
if (hClearAllHits == null)
{
SetFailState("Signature 'ClearAllSurvivorHits' not found or broken! Please update!");
}
// StartPrepSDKCall(SDKCall_Entity);
// PrepSDKCall_SetFromConf(hGamedata, SDKConf_Signature, "MarkSurvivorAsHit");
// PrepSDKCall_AddParameter(SDKType_CBasePlayer, SDKPass_Pointer);
// hMarkAsHit = EndPrepSDKCall();
// if (hMarkAsHit == null)
// {
// SetFailState("Signature 'MarkSurvivorAsHit' not found or broken! Please update!");
// }
delete hGamedata;
HookEvent("charge_impact", OnChargeImpact);
}
public void OnPluginEnd()
{
UnhookEvent("charge_impact", OnChargeImpact);
}
public void OnChargerImpact(Event event, const char[] name, bool dontBroadcast)
{
int charger = GetClientOfUserId(event.GetInt("userid");
if (!charger)
{
return;
}
int iChargerAbility = GetEntPropEnt(charger, Prop_Send, "m_customAbility");
if (IsValidEntity(iChargerAbility))
{
// To do: Since L4D2 Direct has the ability to force animation event to both teams,
// all we need is to GET those animation events for proper checking of recently impacted survivors.
// I better hope Spirit can do this. :)
SDKCall(hClearAllHits, iChargerAbility);
}
}
|
|
|
|