Raised This Month: $ Target: $400
 0% 

Simple health plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Niborius
New Member
Join Date: Mar 2009
Old 07-07-2011 , 08:45   Simple health plugin
Reply With Quote #1

I just learned how to script 10 minutes ago (meaning I am a total noob at it) and I would like to know how to make a plugin that changes the max health for Half-Life 1.

As of now I got this but I know it contains a lot of errors (I followed a tutorial but I tried to follow it my way, resulting in this: )

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

public plugin_init()

{

register_plugin("nibmod","1.0","Niborius")
register_clcmd("Bind_this_sentence","model_hp_change")

}

public model_hp_change

{

set_user_health(id,150)

return PLUGIN_HANDLED

}
Can anyone help me a hand here? Thanks a lot!
Niborius is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 07-07-2011 , 09:12   Re: Simple health plugin
Reply With Quote #2

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

public plugin_init()
{
register_plugin("nibmod","1.0","Niborius")
register_clcmd("Bind_this_sentence","model_hp_change")
}

public 
model_hp_change(id)
{
set_user_health(id,150)
return 
PLUGIN_HANDLED

you should really hook spawn event and set the hp there, since players can just use "Bind_this_sentence" serveral times to get 150 hp again
jimaway is offline
Niborius
New Member
Join Date: Mar 2009
Old 07-07-2011 , 09:59   Re: Simple health plugin
Reply With Quote #3

Thanks, that already helped me a lot.

I however forgot to mention that this is for half-life single player.

Is it possible to make it so that the 150hp can be gained by healthkits and not a console command? Yeah, I know, I suck at this. I've edited loads of scripts for other games, but never made a script from scratch.

Thanks in advance!
Niborius is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 07-07-2011 , 10:32   Re: Simple health plugin
Reply With Quote #4

I would rather make a cvar for how much hp they should get... and set it to everyone at the spawn instead of making them type or bind something.
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>

new gHealth;

public 
plugin_init()
{
    
register_plugin("nibmod","1.0","Niborius"
    
gHealth register_cvar("hp_on_spaawn""200")
    
RegisterHam(Ham_Spawn"player""HamSpawnEvent"1)
}

public 
HamSpawnEvent(id)
{
    if(
is_user_alive(id))
    {
        
set_user_health(idget_pcvar_num(gHealth))
    }


Last edited by Erox902; 07-07-2011 at 10:33. Reason: typo
Erox902 is offline
RollerBlades
Senior Member
Join Date: Feb 2011
Location: Sweden
Old 07-07-2011 , 10:39   Re: Simple health plugin
Reply With Quote #5

or he could get the players current health and add 100hp to it:
PHP Code:
#include <amxmodx>
#include <fun>
#include <hamsandwich>

new gHealth;

public 
plugin_init()
{
    
register_plugin("nibmod","1.0","Niborius"); 
    
gHealth register_cvar("hp_on_spaawn""100");
    
RegisterHam(Ham_Spawn"player""HamSpawnEvent"1);
}

public 
HamSpawnEvent(id)
{
    if(
is_user_alive(id))
    {
        
set_user_health(idget_user_health(id) + get_pcvar_num(gHealth));
    }

RollerBlades is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 07-07-2011 , 10:48   Re: Simple health plugin
Reply With Quote #6

yeah I just thought if he wanted all to get the same hp just a little more than the normal
Erox902 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 06:20.


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