AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   Set Health (https://forums.alliedmods.net/showthread.php?t=73994)

MrBlip 07-10-2008 00:38

Set Health
 
3 Attachment(s)
SetHealth by Mr. Blip
  • Sets a player, an entire team, or everyone's health to the specified amount.
about:
I looked and looked and couldn't find a plugin that sets a players health to a specified amount in a manner that I wanted it to. The closest thing I could find was one that was buried in the 'Super Admin' plugin, but it seemed messy and didn't work as I wanted it to (for example, @T and @CT actually targeted all). So, with the help of bl4nk, I set forth on a journey on how to create my own plugins and this is what I came up with.

Cvars:
  • sm_sethealth_version = 1.0
Usage:
  • sm_sethealth <#userid|name> <amount>
  • EX: sm_sethealth @all 500
To-Do:
  • Logging (forgot all about it until just now)
  • Checking for negative numbers (not sure what effect this will have on the plugin)
  • Possibly include a 'silent' command? (for those sneaky admins)
The plugin definitely works for CS:S, so for right now that's the game. If anyone can confirm that it works for DoD:S or TF2 that'd be great.

Change Log:

Version 1.2.2
  • Fixed health on engineer not working
Version 1.2.1
  • Setting health in TF2 should now work as intended
  • Setting health to 0 in TF2 will cause the players to explode, all other mods SHOULD reset health to 1
Version 1.2
  • Added better support for TF2
Version 1.1
  • Added logging
  • Only allows numbers greater then 0
  • Removed 's from the phrases file.
Version 1.0
  • Initial Release
Again, many thanks to bl4nk for pointing me in the right direction.

Greyscale 07-10-2008 00:42

Re: Set Health
 
We really need a sethealth command in the SM core commands

Liam 07-10-2008 01:14

Re: Set Health
 
This works, the only thing I see with it though is that SetEntityHealth doesn't change the max value that the health can be, so you should really put a check in to see if they are exceeding that amount, otherwise its going to trickle back down.

MrBlip 07-10-2008 08:57

Re: Set Health
 
Updated to version 1.1:
  • Added logging
  • Health amount must be greater then 0
  • Removed the 's from the phrases file.
I'll see if I can figure how to do what you said, Liam.

CaffeinePowered 07-22-2008 12:29

Re: Set Health
 
Hm, I wonder if this could be modified to roll back the +50 health on pyros from the back burner...

Lebson506th 07-22-2008 13:08

Re: Set Health
 
This would be cooler if it was like Mani's that could

1) Target players using regex.

ie sm_sethealth "Apple" 2

Would set RedApple, Apple Cider, and Applerleorler's health to 2

2) When health is set to 0, make the target explode.

Unrealomega 07-22-2008 17:44

Re: Set Health
 
Works perfect on TF2. Though, it doesn't go past 500 HP and drains your health to 0 if you go over 500; it doesn't kill you, just drains the rest of the way. For instance:

If I set my health to 1000, it will drain my health to 0. It won't kill me, but restart me at 500 and continue to drain me until I'm back to full health.

I believe the reason for this isn't because the game can't handle above 500, but that it registers anything about the classes maximum health(Without bonus) as a bonus. So it will drain it the same way. The only thing I can say to remendy this would to either max it out at 500 for TF2.

It's a minor inconvience. The worst that happens is your health depletes to 0, you have the death animation, but resets to 500 before it registers it as a death.

MrBlip 07-22-2008 18:24

Re: Set Health
 
Updated to version 1.2:
  • For TF2: sets the players max health to the specified amount (shouldn't decrease), only if the new max health exceeds the class' default max health. Otherwise it just changes their current health to the specified amount
Not tested on a TF2 server yet, so if I can get a confirmation that this is working correctly that'd be great. The only problem I have with it is it doesn't take a pyro equipped with a backburner into account, but I'll fix that when I have more time.

Quote:

Originally Posted by CaffeinePowered (Post 656654)
Hm, I wonder if this could be modified to roll back the +50 health on pyros from the back burner...

I'll make a cvar in the next version that will do just that.

Quote:

Originally Posted by Lebson506th (Post 656674)
This would be cooler if it was like Mani's that could

1) Target players using regex.

ie sm_sethealth "Apple" 2

Would set RedApple, Apple Cider, and Applerleorler's health to 2

2) When health is set to 0, make the target explode.

I find that option 1 would be rather annoying, but I'll see if I can make an extra command to do what you're asking (if I can find out how).

Option 2, on the other hand, sounds incredibly awesome. Expect that in the next release.

Unrealomega 07-22-2008 18:33

Re: Set Health
 
I want to make note that DOD:S works fine. Most likely because it doesn't have a health ceiling like TF2.

Unrealomega 07-22-2008 18:47

Re: Set Health
 
I'm getting an unknown command. The plugin is loaded properly, but I'm getting this error:

Code:

L 07/22/2008 - 15:46:11: [SM] Native "SetEntProp" reported: Property "m_iMaxHealth" not found (entity 1/player)
L 07/22/2008 - 15:46:11: [SM] Debug mode is not enabled for "sm_sethealth.smx"
L 07/22/2008 - 15:46:11: [SM] To enable debug mode, edit plugin_settings.cfg, or type: sm plugins debug 13 on



All times are GMT -4. The time now is 09:02.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.