I am having some issues getting code to work to buildings which are upgraded in tf2, by adding metal to the upgrade.
The part where it is first built works fine, adds the 100 metal. But on upgraded nothing happens apart from the 'test' message and nothing in console.
On a side note, does anyone know which entprop value to change for build time?
Code:
public OnPluginStart()
{
HookEvent("player_builtobject", event_playerbuilt, EventHookMode_Post);
HookEvent("player_upgradedobject", event_playerbuiltupgrade, EventHookMode_Post);
}
public Action:event_playerbuilt(Handle:event, const String:name[], bool:dontBroadcast)
{
new obj_built = GetEventInt(event, "index");
SetEntProp(obj_built, Prop_Send, "m_iUpgradeMetal", 100);
return Plugin_Continue;
}
public Action:event_playerbuiltupgrade(Handle:event, const String:name[], bool:dontBroadcast)
{
new obj_built2 = GetEventInt(event, "index");
SetEntProp(obj_built2, Prop_Send, "m_iUpgradeMetal", 100);
PrintCenterTextAll("test");
return Plugin_Continue;
}
__________________