Raised This Month: $ Target: $400
 0% 

max hp amount


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
linuxas
Member
Join Date: Sep 2013
Old 05-06-2014 , 15:09   max hp amount
Reply With Quote #1

Hi, guys. Im trying to make plugin where i could make a limit of hp for a player. So if set to 100, player cant have 101, 150 or 255 hp in no way... I was trying to browse forum, i have found this: https://forums.alliedmods.net/showth...=85774?t=85774 , but its not helping for me... I no need all the plugin, just the main lines which would set the limit and I would create plugin myself then... Thank you, and sorry for bad english.

Last edited by linuxas; 05-06-2014 at 15:10.
linuxas is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-07-2014 , 12:45   Re: max hp amount
Reply With Quote #2

PHP Code:
public plugin_init()
{
register_event("Health""EventHealth""be""1>0");
}
public 
EventHealth(client)
{

currenthp=get_user_health(client)
if(
currenthp>g_maxhp[client])
{
set_user_health(clientg_maxhp[client])
}


took hp change detection from exolent

Last edited by aron9forever; 05-08-2014 at 07:27. Reason: credits
aron9forever is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-08-2014 , 03:00   Re: max hp amount
Reply With Quote #3

Here is a version using HamSandwich

Code:
#inlcude <amxmodx> #include <hamsandwich> #inlclude <fun> new hp_limit[33] public plugin_init(){     register_plugin("HP Limit", "v1.00", "XxXxXxXxX")     RegisterHam(Ham_TakeHealth, "player", "evt_HamHeal") } public evt_HamHeal(id) {     new iHp = get_user_health(id)     if (iHp > hp_limit[id])     {         set_user_health(id, hp_limit[id])     } }

EDIT:
Quote:
Originally Posted by aron9forever View Post
public plugin_init()
{
register_event("Health", "EventHealth", "be", "1>0");
}
public EventHealth(client)
{

currenthp=get_user_health(client)
if(currenthp>g_maxhp[client])
{
set_user_health(client, g_maxhp[client])
}

}
P.S. Place code in pawn / code / php BB markups
__________________

Last edited by ezio_auditore; 05-08-2014 at 03:11.
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 05-08-2014 , 07:26   Re: max hp amount
Reply With Quote #4

Quote:
Originally Posted by ezio_auditore View Post
Here is a version using HamSandwich

Code:
#inlcude <amxmodx> #include <hamsandwich> #inlclude <fun> new hp_limit[33] public plugin_init(){     register_plugin("HP Limit", "v1.00", "XxXxXxXxX")     RegisterHam(Ham_TakeHealth, "player", "evt_HamHeal") } public evt_HamHeal(id) {     new iHp = get_user_health(id)     if (iHp > hp_limit[id])     {         set_user_health(id, hp_limit[id])     } }

EDIT:


P.S. Place code in pawn / code / php BB markups
I wanted to use ham first but I was unsure whether it records negative damage

Code:
#include <amxmodx> #include <hamsandwich> #include <fun> new hp_limit[33] public plugin_init(){     register_plugin("HP Limit", "v1.00", "XxXxXxXxX")     RegisterHam(Ham_TakeHealth, "player", "evt_HamHeal") } public evt_HamHeal(id) {     if (get_user_health(id) > hp_limit[id])     {         set_user_health(id, hp_limit[id])     } }
optimized & fixed includes

Last edited by aron9forever; 05-08-2014 at 07:30.
aron9forever is offline
wickedd
Veteran Member
Join Date: Nov 2009
Old 05-08-2014 , 07:36   Re: max hp amount
Reply With Quote #5

Quote:
Originally Posted by ezio_auditore View Post
Here is a version using HamSandwich

PHP Code:
#inlcude <amxmodx>
#include <hamsandwich> 
#inlclude <fun>  

new hp_limit[33
 
public 
plugin_init()
{    
    
register_plugin("HP Limit""v1.00""XxXxXxXxX")     
    
RegisterHam(Ham_TakeHealth"player""evt_HamHeal"
}  

public 
evt_HamHeal(id
{     
    new 
iHp get_user_health(id)     
    if (
iHp hp_limit[id]) 
    { 
         
set_user_health(idhp_limit[id]) 
    } 

NO!

Edit: @aron

NO!
__________________
Just buy the fucking game!!!!
I hate No-Steamers and lazy ass people.

Last edited by wickedd; 05-08-2014 at 07:46.
wickedd is offline
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-08-2014 , 10:37   Re: max hp amount
Reply With Quote #6

why not this ?

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

new g_iHealthStartCvar;

public 
plugin_init( )
{
    
register_plugin"Health Start""0.1""swapped" );

    
RegisterHamHam_Spawn"player""FwdPlayerRespawn");

    
g_iHealthStartCvar register_cvar"mp_starthealth""150" );
}

public 
FwdPlayerRespawnPlayerID )
{
    if ( 
is_user_alivePlayerID ) )
    {
        
set_user_healthPlayerIDget_pcvar_numg_iHealthStartCvar ) );
    }

swapped is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-09-2014 , 04:15   Re: max hp amount
Reply With Quote #7

Quote:
Originally Posted by swapped View Post
why not this ?

PHP Code:
#include <amxmodx>
#include <hamsandwich> 
#include <fun>  
 
new g_iHealthStartCvar;
 
public 
plugin_init( )
{
    
register_plugin"Health Start""0.1""swapped" );
 
    
RegisterHamHam_Spawn"player""FwdPlayerRespawn");
 
    
g_iHealthStartCvar register_cvar"mp_starthealth""150" );
}
 
public 
FwdPlayerRespawnPlayerID )
{
    if ( 
is_user_alivePlayerID ) )
    {
        
set_user_healthPlayerIDget_pcvar_numg_iHealthStartCvar ) );
    }

No!.
he wants hp limit, not set hp on spawn.!
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-09-2014 , 04:30   Re: max hp amount
Reply With Quote #8

how it possibile to increase hp ?

( i mean in game. )
swapped is offline
ezio_auditore
Senior Member
Join Date: May 2013
Old 05-09-2014 , 04:35   Re: max hp amount
Reply With Quote #9

Quote:
Originally Posted by swapped View Post
how it possibile to increase hp ?

( i mean in game. )
By using fun module's
Code:
set_user_health(index, iNewHp)
__________________
ezio_auditore is offline
Send a message via Skype™ to ezio_auditore
swapped
BANNED
Join Date: Mar 2014
Location: OrpheuRegisterHook
Old 05-09-2014 , 04:38   Re: max hp amount
Reply With Quote #10

Quote:
Originally Posted by ezio_auditore View Post
By using fun module's
Code:
set_user_health(index, iNewHp)
event health is not check when player recieve health with native set_user_health ( tested )

you should made an infinite task, check if user is alive and have more than max hp amount and set the default hp amount.
swapped is offline
Old 05-09-2014, 04:50
ezio_auditore
This message has been deleted by ezio_auditore. Reason: Code was not edited properly.
Reply


Thread Tools
Display Modes

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:37.


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