jump.tf Forums
Welcome B)

Plugin Request

internal

  • Novice
  • **
    • Posts: 75
    • Frags: +0/-0
    • View Profile
Could someone make a plugin for the health that works in a similar way like the tpn servers, ignoring the hurtme triggers of a map and keeping your hp always at 500 ?


Mireal

  • Intermediate
  • ***
    • Posts: 149
    • Frags: +0/-0
    • View Profile
can someone make me a tas plugin while you are at it
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down


AI

  • Administrator
  • Proficient
  • *****
    • Posts: 417
    • Frags: +0/-0
  • Plugins Developer
    • View Profile
    • Jump Academy
Could someone make a plugin for the health that works in a similar way like the tpn servers, ignoring the hurtme triggers of a map and keeping your hp always at 500 ?

Code: [Select]
#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

#define PLUGIN_VERSION "0.1.0"

public Plugin:myinfo = {
  name = "Don't Hurtme",
  author = "AI",
  description = "Baby don't hurt me / Don't hurt me / No more",
  version = PLUGIN_VERSION,
  url = "jump.tf"
}

public OnPluginStart() {
  HookEventEx("game_start", OnRoundStart);
  HookEventEx("teamplay_round_start", OnRoundStart);
  HookEvent("player_spawn", OnPlayerSpawn);
}

public Action:OnRoundStart(Handle:hEvent, const String:sName[], bool:bDontBroadcast) {
  new iEntity = INVALID_ENT_REFERENCE;
  while ((iEntity = FindEntityByClassname(iEntity, "trigger_hurt")) != INVALID_ENT_REFERENCE) {
    SDKHookEx(iEntity, SDKHook_StartTouch, OnTouch);
    SDKHookEx(iEntity, SDKHook_Touch, OnTouch);
    SDKHookEx(iEntity, SDKHook_EndTouch, OnTouch);
  }
}

public Action:OnTouch(iEntity, iOther) {
  if (1 <= iOther && iOther <= MaxClients) {
    return Plugin_Handled;
  }
 
  return Plugin_Continue;
}

public Action:OnPlayerSpawn(Handle:hEvent, const String:sName[], bool:bDontBroadcast) {
  new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
  SetEntProp(iClient, Prop_Data, "m_takedamage", 1, 1); // Buddha
 
  return Plugin_Continue;
}

There is no need for 500 HP if you have buddha mode on.

Untested, but here you go.


AI

  • Administrator
  • Proficient
  • *****
    • Posts: 417
    • Frags: +0/-0
  • Plugins Developer
    • View Profile
    • Jump Academy

Mireal

  • Intermediate
  • ***
    • Posts: 149
    • Frags: +0/-0
    • View Profile
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down
man cannot ascend with worldly values holding him down



internal

  • Novice
  • **
    • Posts: 75
    • Frags: +0/-0
    • View Profile
Could someone make a plugin for the health that works in a similar way like the tpn servers, ignoring the hurtme triggers of a map and keeping your hp always at 500 ?

Code: [Select]
#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>
#include <sdktools>

#define PLUGIN_VERSION "0.1.0"

public Plugin:myinfo = {
  name = "Don't Hurtme",
  author = "AI",
  description = "Baby don't hurt me / Don't hurt me / No more",
  version = PLUGIN_VERSION,
  url = "jump.tf"
}

public OnPluginStart() {
  HookEventEx("game_start", OnRoundStart);
  HookEventEx("teamplay_round_start", OnRoundStart);
  HookEvent("player_spawn", OnPlayerSpawn);
}

public Action:OnRoundStart(Handle:hEvent, const String:sName[], bool:bDontBroadcast) {
  new iEntity = INVALID_ENT_REFERENCE;
  while ((iEntity = FindEntityByClassname(iEntity, "trigger_hurt")) != INVALID_ENT_REFERENCE) {
    SDKHookEx(iEntity, SDKHook_StartTouch, OnTouch);
    SDKHookEx(iEntity, SDKHook_Touch, OnTouch);
    SDKHookEx(iEntity, SDKHook_EndTouch, OnTouch);
  }
}

public Action:OnTouch(iEntity, iOther) {
  if (1 <= iOther && iOther <= MaxClients) {
    return Plugin_Handled;
  }
 
  return Plugin_Continue;
}

public Action:OnPlayerSpawn(Handle:hEvent, const String:sName[], bool:bDontBroadcast) {
  new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
  SetEntProp(iClient, Prop_Data, "m_takedamage", 1, 1); // Buddha
 
  return Plugin_Continue;
}

There is no need for 500 HP if you have buddha mode on.

Untested, but here you go.


its working but it doesnt ignore the hurtme from maps causing offline lag
doesnt buddha ignores the splash damage when youre too low hp ?


RNC1839

  • Proficient
  • ****
    • Posts: 499
    • Frags: +0/-0
    • View Profile

AI

  • Administrator
  • Proficient
  • *****
    • Posts: 417
    • Frags: +0/-0
  • Plugins Developer
    • View Profile
    • Jump Academy
its working but it doesnt ignore the hurtme from maps causing offline lag
doesnt buddha ignores the splash damage when youre too low hp ?

Buddha in the TF2 case keeps the player at the current health, so you should not reach the low HP situation that ignores splash damage.

As for the trigger_hurt, I will have a look at the code again when I get back home.

If you want to go with RNC's route, just swap the OnRoundStart code with:

Code: [Select]
public Action:OnRoundStart(Handle:hEvent, const String:sName[], bool:bDontBroadcast) {
  new iEntity = INVALID_ENT_REFERENCE;
  while ((iEntity = FindEntityByClassname(iEntity, "trigger_hurt")) != INVALID_ENT_REFERENCE) {
    RemoveEdict(iEntity);
  }
}


internal

  • Novice
  • **
    • Posts: 75
    • Frags: +0/-0
    • View Profile
ill w8 for your new code tomorrow, its getting kind of late, going to bed soon, thanks for the quick responses !


Catface100

  • Newbie
  • *
    • Posts: 8
    • Frags: +0/-0
    • View Profile
Here's the one I use on my server, made by intrets.

https://www.dropbox.com/s/inkm0fjpx7tef9m/sollyhp.smx?dl=0

Gives solly 500hp and keeps other classes at default.


internal

  • Novice
  • **
    • Posts: 75
    • Frags: +0/-0
    • View Profile
your plugin didnt worked catface, also i replaced the code onroundstart and didnt worked either
 ent_removeall trigger_hurt does nothing and its ent_remove_all trigger_hurt
help ?


AI

  • Administrator
  • Proficient
  • *****
    • Posts: 417
    • Frags: +0/-0
  • Plugins Developer
    • View Profile
    • Jump Academy
It turns out for some maps the overheal actually comes from a trigger_multiple rather than trigger_hurt.


internal

  • Novice
  • **
    • Posts: 75
    • Frags: +0/-0
    • View Profile

AI

  • Administrator
  • Proficient
  • *****
    • Posts: 417
    • Frags: +0/-0
  • Plugins Developer
    • View Profile
    • Jump Academy
Skylight uses both.  Try this cleaner version that blocks trigger_hurt and trigger_multiple:

Code: [Select]
#pragma semicolon 1

#include <sourcemod>
#include <sdkhooks>
#include <tf2>

#define PLUGIN_VERSION "0.2.0"

public Plugin:myinfo = {
  name = "Don't Hurtme",
  author = "AI",
  description = "Baby don't hurt me / Don't hurt me / No more",
  version = PLUGIN_VERSION,
  url = "jump.tf"
}

public OnPluginStart() {
  HookEvent("player_spawn", OnPlayerSpawn);
}

public OnEntityCreated(iEntity, const String:sClassname[]) {
  if (StrEqual(sClassname, "trigger_hurt") || StrEqual(sClassname, "trigger_multiple")) {
    SDKHookEx(iEntity, SDKHook_Touch, OnTouch);
  }
}


public Action:OnTouch(iEntity, iOther) {
  if (1 <= iOther && iOther <= MaxClients) {
    return Plugin_Handled;
  }
 
  return Plugin_Continue;
}

public Action:OnPlayerSpawn(Handle:hEvent, const String:sName[], bool:bDontBroadcast) {
  new iClient = GetClientOfUserId(GetEventInt(hEvent, "userid"));
  SetEntProp(iClient, Prop_Data, "m_takedamage", 1, 1); // Buddha
 
  return Plugin_Continue;
}