AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Safe room health bump to 50% (https://forums.alliedmods.net/showthread.php?t=225685)

Austinbots 09-07-2013 22:13

Safe room health bump to 50%
 
I have a plugin to bump survivor's health up to 50% when they spawn in the safe room.
This keeps people from killing each other when they reach the safe room just to get the default 50% spawn health in safe room.

I have it it working where it gives 50% health but it has these remaining problems:

1) it sets health to 50% but the health bar display doesn't show the health correctly.
The heath bar shows everyone that was set as having very little health, even though they do have 50% and they see 50%.

2) It doesn't reset the black and white status if you entered the safe room B+W.
And now on first hit you will die even though you have 50% health. I am guessing I have to reset the incap count but my try at resetting it doesn't work.

3) If you had temp health going into the safe room you keep your temp health and this means you can get more then 100% heath counting your temp health. I would like to reset all temp healt or probably better give only up to 100 health counting your new 50 health and your left over temp health.
Here is my code.

As always, thanks for any help!

Code:

public Action:timer_PlayerSpawn(Handle:timer, any:client)
{
    if(IsClientInGame(client))
    {
        if(GetClientHealth(client) < 50)
        {
            // bump health up to 50%
            SetEntityHealth(client, 50);
           
            // reset player B&W count
            SetEntProp(client, Prop_Send, "m_currentReviveCount", 0)                         

            //ClientCommand(client, "music_dynamic_stop_playing Player.Heartbeat"); // stop the music

            //set temp heath to 0
            //SetEntPropFloat(client, Prop_Send, "m_healthBuffer", 0.0);

            new temphpoffset = FindSendPropOffs("CTerrorPlayer","m_healthBuffer");
            SetEntDataFloat(client, temphpoffset, 0.0, true);
           
        }
    }
}


Marcus101RR 09-08-2013 00:15

Re: Safe room health bump to 50%
 
Quote:

Originally Posted by Austinbots (Post 2030353)
I have a plugin to bump survivor's health up to 50% when they spawn in the safe room.
This keeps people from killing each other when they reach the safe room just to get the default 50% spawn health in safe room.

I have it it working where it gives 50% health but it has these remaining problems:

1) it sets health to 50% but the health bar display doesn't show the health correctly.
The heath bar shows everyone that was set as having very little health, even though they do have 50% and they see 50%.

2) It doesn't reset the black and white status if you entered the safe room B+W.
And now on first hit you will die even though you have 50% health. I am guessing I have to reset the incap count but my try at resetting it doesn't work.

3) If you had temp health going into the safe room you keep your temp health and this means you can get more then 100% heath counting your temp health. I would like to reset all temp healt or probably better give only up to 100 health counting your new 50 health and your left over temp health.
Here is my code.

As always, thanks for any help!

Code:

public Action:timer_PlayerSpawn(Handle:timer, any:client)
{
    if(IsClientInGame(client))
    {
        if(GetClientHealth(client) < 50)
        {
            // bump health up to 50%
            SetEntityHealth(client, 50);
           
            // reset player B&W count
            SetEntProp(client, Prop_Send, "m_currentReviveCount", 0)                         

            //ClientCommand(client, "music_dynamic_stop_playing Player.Heartbeat"); // stop the music

            //set temp heath to 0
            //SetEntPropFloat(client, Prop_Send, "m_healthBuffer", 0.0);

            new temphpoffset = FindSendPropOffs("CTerrorPlayer","m_healthBuffer");
            SetEntDataFloat(client, temphpoffset, 0.0, true);
           
        }
    }
}


It defeats the purpose of setting health to 50% in saferoom, when you transition to the next map, survivors already get 50% to begin with after death. So you must be setting their health back to 50, even if they are not dead. As for the black and white, you cannot remove black and white as far as i know, unless sdkhooks is involved. You can remove temp health by setting it to 0, should not be difficult.

Someone said that to enforce black and white you had to set the max incaps, the health to 0, the temp health higher than 0, and the is going to die tag to 1. If this is true, then setting the opposite, should rectify the black and white status. Don't quote me on that.

Remove/Fix Temp Health:
PHP Code:

SetEntPropFloat(clientProp_Send"m_healthBuffer"0.0); 

Fix/Remove Health Display Incorrect:
PHP Code:

SetEntProp(clientProp_Send"m_isGoingToDie"0); 



All times are GMT -4. The time now is 23:30.

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