AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Zombie Plague Mod (https://forums.alliedmods.net/forumdisplay.php?f=126)
-   -   [ZP]Items Extra : more Hp human and zombie (https://forums.alliedmods.net/showthread.php?t=87818)

intoxicadooo 03-16-2009 18:59

[ZP]Items Extra : more Hp human and zombie
 
Someone has to plug the sub when you purchase more life to the zombie and the human, please!

AlejandroSk 03-16-2009 19:26

Re: [ZP]Items Extra : more Hp human and zombie
 
PHP Code:


/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta_util>
#include <hamsandwich>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Life"
#define VERSION "0.1"
#define AUTHOR "AlejandroSk"

new bool:g_HasLife[33]
new 
g_itemid1

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_itemid1 zp_register_extra_item("Life [150] "15ZP_TEAM_HUMAN)
    
RegisterHam(Ham_Spawn"player""Fwd_PlayerSpawn_Post"1)
}

public 
zp_extra_item_selected(iditem)
{
    if (
item == g_itemid1)
    {
        
g_HasLife[id] = true
        
new user_health get_user_health(id)
        
fm_set_user_health(iduser_health 150)
    }
}

public 
Fwd_PlayerSpawn_Post(id)
{
    if (
g_HasLife[id])
    {
        
g_HasLife[id] = false
    
}


not tested.

intoxicadooo 03-16-2009 19:44

Re: [ZP]Items Extra : more Hp human and zombie
 
Thanks it does me out.
I'll give you karma for further help: D

AlejandroSk 03-16-2009 19:55

Re: [ZP]Items Extra : more Hp human and zombie
 
Quote:

Originally Posted by intoxicadooo (Post 782290)
Thanks it does me out.
I'll give you karma for further help: D

you tested it?

intoxicadooo 03-16-2009 20:05

Re: [ZP]Items Extra : more Hp human and zombie
 
Quote:

Originally Posted by AlejandroSk (Post 782294)
you tested it?

Do not pass this 1 friend

I had to change 1 little xD

alan_el_more 03-16-2009 22:21

Re: [ZP]Items Extra : more Hp human and zombie
 
That would be more stringent:

PHP Code:

#include <amxmodx>
#include <fakemeta_util>
#include <zombieplague>

#define PLUGIN "[ZP] Extra Item: Life"
#define VERSION "0.1"
#define AUTHOR "AlejandroSk"

new g_itemid1

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
g_itemid1 zp_register_extra_item("Life [150] "15ZP_TEAM_HUMAN)
}

public 
zp_extra_item_selected(iditem)
{
    if (
item == g_itemid1)
    {
        new 
user_health get_user_health(id)
        
fm_set_user_health(iduser_health 150)
    }



SnoW 03-17-2009 11:45

Re: [ZP]Items Extra : more Hp human and zombie
 
The code just gets better on every change... It's gonna be awesome if we keep like this!
Code:

#include <amxmodx>
#include <fakemeta>
#include <zombieplague>
 
#define PLUGIN "[ZP] Extra Item: Life"
#define VERSION "0.1"
#define AUTHOR "AlejandroSk"
 
new g_itemid1
 
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_itemid1 = zp_register_extra_item("Life [150] ", 15, ZP_TEAM_HUMAN)
}
 
public zp_extra_item_selected(id, item)
  if (item == g_itemid1)
      set_pev(id, pev_health, pev(id, pev_health) + 150.0)

Though I think it can't be optimized anymore, lol...

AlejandroSk 03-17-2009 13:23

Re: [ZP]Items Extra : more Hp human and zombie
 
But can be better.

what about a sound?
PHP Code:

 #include <amxmodx>
#include <fakemeta>
#include <zombieplague>
 
#define PLUGIN "[ZP] Extra Item: Life"
#define VERSION "0.1"
#define AUTHOR "AlejandroSk"
 
new g_itemid1
 
public plugin_init()
{
register_plugin(PLUGINVERSIONAUTHOR)
g_itemid1 zp_register_extra_item("Life [150] "15ZP_TEAM_HUMAN)
}
 
 public 
plugin_precache()
 {
     
precache_sound("items/smallmedkit1.wav")
}
    
public 
zp_extra_item_selected(iditem)
   if (
item == g_itemid1)
   {
       
set_pev(idpev_healthpev(idpev_health) + 150.0)
       
emit_sound(id,CHAN_VOICE,"items/smallmedkit1.wav"1.0ATTN_NORM0PITCH_NORM)
      } 


SnoW 03-17-2009 14:16

Re: [ZP]Items Extra : more Hp human and zombie
 
Quote:

Originally Posted by AlejandroSk (Post 782813)
But can be better.

what about a sound?

Adding new features doesn't always make a simple plugin better. I think it's perfect, lol. :crab:
OT: About the karma with comment "thanks". If you really wanna thank me, give plus karma instead of minus :wink:

MeRcyLeZZ 03-17-2009 14:44

Re: [ZP]Items Extra : more Hp human and zombie
 
If you want this for zombies too, you can do:
Code:
zp_register_extra_item("Life [150] ", 15, ZP_TEAM_HUMAN | ZP_TEAM_ZOMBIE)


All times are GMT -4. The time now is 16:59.

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