Raised This Month: $ Target: $400
 0% 

Save health over round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
STr!ker
Senior Member
Join Date: Jun 2009
Location: Germany
Old 01-01-2012 , 20:12   Save health over round
Reply With Quote #1

Hello i have a shop, where you can buy hp, but when the next round starts he has only 100hp. How i can set, that he becomes back his old hp, if it is over 100 hp???
STr!ker is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-01-2012 , 20:15   Re: Save health over round
Reply With Quote #2

Hook spawn and reset their health to what it should be.
__________________
fysiks is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 01-01-2012 , 20:17   Re: Save health over round
Reply With Quote #3

Store each players health in an array at round end (if they have more than 100hp)
Give them that health in the spawn function and clear the array. (You might have to set a small task from the spawn function, I'm not 100% sure)
Erox902 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-02-2012 , 06:34   Re: Save health over round
Reply With Quote #4

Something like this
PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new Float:g_flHealth33 ];

public 
plugin_init( )
{
    
register_plugin"""""xPaw" );
    
    
RegisterHamHam_Spawn"player""FwdHamPlayerSpawnPre" );
    
RegisterHamHam_Spawn"player""FwdHamPlayerSpawn"true );
}

public 
FwdHamPlayerSpawnPre( const id )
{
    if( 
is_user_aliveid ) )
    {
        
pevidpev_healthg_flHealthid ] );
    }
    else
    {
        
g_flHealthid ] = 0.0;
    }
}

public 
FwdHamPlayerSpawn( const id )
{
    if( 
g_flHealthid ] )
    {
        
set_pevidpev_healthg_flHealthid ] );
    }

__________________
xPaw is offline
STr!ker
Senior Member
Join Date: Jun 2009
Location: Germany
Old 01-02-2012 , 17:09   Re: Save health over round
Reply With Quote #5

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >

new Float:g_flHealth33 ];

public 
plugin_init( )
{
    
register_plugin"""""xPaw" );
    
    
RegisterHamHam_Spawn"player""FwdHamPlayerSpawnPre" );
    
RegisterHamHam_Spawn"player""FwdHamPlayerSpawn"true );
}

public 
FwdHamPlayerSpawnPre( const id )
{
    if( 
is_user_aliveid ) )
    {
        
pevidpev_healthg_flHealthid ] );
    }
    else
    {
        
g_flHealthid ] = 0.0;
    }
}

public 
FwdHamPlayerSpawn( const id )
{
    if( 
g_flHealthid ] < 100 )
    {
        
set_pevidpev_healthg_flHealthid ] );
    }



Thx, the main part works, but if the player has under 100 hp it shouldn´t work. Can i write this:
if( g_flHealth[ id ] < 100 )
STr!ker is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 01-03-2012 , 08:04   Re: Save health over round
Reply With Quote #6

It should be > 100
__________________
xPaw is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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