View Single Post
dacisco
Junior Member
Join Date: Aug 2018
Old 08-16-2018 , 20:19   Re: Custom Minigun Property
Reply With Quote #7

Okay so I made the omissions that you suggested, that is, if I did it right:

Code:
/**
 * Sourcemod 1.7 Plugin Template
 */
#pragma semicolon 1
#include <sourcemod>

#include <tf2_stocks>
#include <dhooks>

#pragma newdecls required

//#include <tf_custom_attributes>

Handle g_DHookMinigunWindDown;

public void OnPluginStart() {
	Handle hGameConf = LoadGameConfigFile("tf2.custattr.sample");
	if (!hGameConf) {
		SetFailState("Missing weapon overhaul gamedata tf2.custattr.sample.txt).");
	}
	
	g_DHookMinigunWindDown = DHookCreateDetour(Address_Null, CallConv_THISCALL, ReturnType_Void,
			ThisPointer_CBaseEntity);
	DHookSetFromConf(g_DHookMinigunWindDown, hGameConf, SDKConf_Signature,
			"CTFMinigun::WindDown()");
	DHookEnableDetour(g_DHookMinigunWindDown, true, OnMinigunWindDownPost);
	
	delete hGameConf;
}

public MRESReturn OnMinigunWindDownPost(int minigun) {
	int owner = GetEntPropEnt(minigun, Prop_Send, "m_hOwnerEntity");
	if (owner < 1 || owner > MaxClients) {
		return MRES_Ignored;
	}
	
	/*KeyValues kv = TF2CustAttr_GetAttributeKeyValues(minigun);
	if (!kv) {
		return MRES_Ignored;
	}
	
	float flBoostDuration = kv.GetFloat("minigun winddown boost duration");
	*/
	//if (flBoostDuration) {
		TF2_AddCondition(owner, TFCond_SpeedBuffAlly, 2.0, owner);
	/*}
	delete kv;*/
	return MRES_Ignored;
}

If this is in fact correct, I still didn't get any luck. I looked in tf2.custattr.sample.txt and realized that you are using:

Code:
"linux"		"@_ZN10CTFMinigun8WindDownEv"
What would be the alternative format for Windows (if this is an issue)?
dacisco is offline