Raised This Month: $ Target: $400
 0% 

Health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sooN
Veteran Member
Join Date: Apr 2009
Old 07-03-2009 , 21:57   Health
Reply With Quote #1

Hello,

I need plugin that remove one health per bullet. If one player full with her weapons ( m4a1 ) he lost 30 hp.. and if it's a deagle he lost 7 hp.

Thanks
__________________

Last edited by sooN; 07-03-2009 at 22:04.
sooN is offline
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 07-04-2009 , 03:22   Re: Health
Reply With Quote #2

Try this:

Code:
#include <amxmodx> #include <hamsandwich> new g_iMaxPlayers; public plugin_init() {     RegisterHam(Ham_TakeDamage, "player", "ham_player_damage");         g_iMaxPlayers = get_maxplayers(); } public ham_player_damage(e_Victim, e_Inflictor, e_Attacker, Float:f_Damage, m_DamageBits) {     if ( 1 <= e_Attacker <= g_iMaxPlayers )     {         SetHamParamFloat(4, 1.0);     } }
__________________
Bollnas Team - HideNSeek

See all of Bollnas Team's HideNSeek
servers at
http://bollnasteam.se/!

LaineN is offline
sooN
Veteran Member
Join Date: Apr 2009
Old 07-04-2009 , 09:03   Re: Health
Reply With Quote #3

You're plugin run but you don't understand me.. if CT shoot he lost 1 hp not ennemy ?
__________________
sooN is offline
LaineN
Veteran Member
Join Date: Mar 2008
Location: Sweden
Old 07-04-2009 , 13:19   Re: Health
Reply With Quote #4

Oh

Try this:
Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich> #pragma semicolon 1 #define PLUGIN_NAME    "Shoot Damage" #define PLUGIN_VERSION    "1.0" #define PLUGIN_AUTHOR    "LaineN" new g_alive[33]; public plugin_init() {     register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);         register_forward(FM_CmdStart,"FwdCmdStart");         RegisterHam(Ham_Spawn, "player", "FwdPlayerSpawn", 1);     RegisterHam(Ham_Killed, "player", "FwdPlayerKilled", 1); } public FwdPlayerSpawn(id) {     if ( !is_user_alive(id) ) g_alive[id] = true; } public FwdPlayerKilled(id) {     g_alive[id] = false; } public FwdCmdStart(id, uc_handle, seed) {     if ( !g_alive[id] ) return FMRES_IGNORED;         new buttons = get_uc(uc_handle, UC_Buttons);         if ( buttons & IN_ATTACK )     {         static health;         pev(id, pev_health, health);                 if ( health > 1 )    set_pev(id, pev_health, health - 1.0);         else                 user_kill(id);     }         return FMRES_IGNORED; }
__________________
Bollnas Team - HideNSeek

See all of Bollnas Team's HideNSeek
servers at
http://bollnasteam.se/!


Last edited by LaineN; 07-04-2009 at 13:21.
LaineN is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-04-2009 , 14:16   Re: Health
Reply With Quote #5

This method will be a bit more resourceful

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

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "bugsy

public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_event"CurWeapon" "fw_EvCurWeapon" "be" "1=1" );
}

public 
fw_EvCurWeaponid )
{
    static 
iWeapon iWeaponTmp;
    static 
iAmmo iAmmoTmp;
    
    
iWeaponTmp read_data);
    
iAmmoTmp read_data);
    
    if ( ( 
iWeapon == iWeaponTmp ) && ( iAmmoTmp iAmmo ) )
        
set_pevid pev_health pevid pev_health ) - 1.0 );
    
    
iAmmo iAmmoTmp;
    
iWeapon iWeaponTmp;    

__________________

Last edited by Bugsy; 07-04-2009 at 14:25.
Bugsy is offline
sooN
Veteran Member
Join Date: Apr 2009
Old 07-04-2009 , 15:40   Re: Health
Reply With Quote #6

Bugsy you're plugin run but when i have 1 health and i shoot i have 0 hp and i'm not die. i'm blocked.
__________________
sooN is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 07-04-2009 , 16:08   Re: Health
Reply With Quote #7

PHP Code:
    if ( ( iWeapon == iWeaponTmp ) && ( iAmmoTmp iAmmo ) )
        
set_pevid pev_health pevid pev_health ) - 1.0 ); 

PHP Code:
    if ( ( iWeapon == iWeaponTmp ) && ( iAmmoTmp iAmmo ) )
    {
        new 
Float:Health;
        
pev(idpev_healthHealth);
 
        if (
Health 1)
            
set_pevid pev_health Health 1.0 );
        else
            
user_kill(id);
    } 
__________________
hleV is offline
sooN
Veteran Member
Join Date: Apr 2009
Old 07-04-2009 , 16:14   Re: Health
Reply With Quote #8

Waaaw, it's perfect Thanks
__________________
sooN 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 15:39.


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