Quote:
Originally Posted by PC Gamer
Naydef... Thanks for sharing your code!
Question: Code above works to heal enemy players. However, it didn't allow me to heal buildings when running on a Windows dedicated server. Can you add the code that allows for healing buildings?
|
You can make something like this:
PHP Code:
public MRESReturn Detour_AllowedToHealTargetPost(int pThis, Handle hReturn, Handle hParams)
{
if(pThis==-1 || DHookIsNullParam(hParams, 1))
{
return MRES_Ignored;
}
int targettoheal=DHookGetParam(hParams, 1);
if(IsValidEntity(targettoheal) && targettoheal>MaxClients)
{
if(HasEntProp(targettoheal, Prop_Send, "m_iHealth"))
{
int health=GetEntProp(targettoheal, Prop_Send, "m_iHealth");
SetEntProp(targettoheal, Prop_Send, "m_iHealth", health+5);
}
}
DHookSetReturn(hReturn, true); // Just try the medigun in the game :)
return MRES_ChangedOverride;
}
Edit: Many things forgot to make...
__________________