View Single Post
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 02-19-2007 , 01:57   Re: Setting users health mod independant
Reply With Quote #7

Quote:
Originally Posted by XxAvalanchexX View Post
Lord_Destros: Then what was he asking?
From what I understood he's saying in some mods people automatically regain health (i.e. if shot down to 60 health from 100, they will slowly heal back up to 100). He was trying to make it so that after setting a users health if they were hurt they would auto regenerate if the mod allowed them to do so.

If I said it was impossible earlier I somewhat lied. Heres the only method I can think of:

To (re/de)generate their health:

1. Simply make a loop that gives players health every X seconds if their HP is greater than 100 UP TO whatever you initially used in set_pev.
2. To degenerate their health (they specify a value less than 100 in set_pev)
Simply make a loop that removes players health every X seconds if their HP is greater than what you initially used in set_pev.

To detect if the mod supports regeneration:

1. Check once every second to see if a players health has increased. If it has then measure the amount it has increased and over what period of time.

Downsides to this method. It will not work if they were hurt but the damage they received was not enough to trigger regeneration and if someone increases a users health via a medical kit or admin command then that will confuse the plugin.

If you want it to be mod independent I suggest just creating 2 cvars with examples shown below
sv_regeneration "<0/1>"
sv_regenerationRate "<Regeneration rate as a float in seconds>"
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.
Lord_Destros is offline
Send a message via AIM to Lord_Destros