Raised This Month: $51 Target: $400
 12% 

[REQ] Need plugin to limit health


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mikado
Senior Member
Join Date: Nov 2012
Location: don't know where :/
Old 03-27-2013 , 06:00   [REQ] Need plugin to limit health
Reply With Quote #1

Hi everybody.

i need plugin which i can limit HP for players
i have sv surf mod using surf shop by Hattrik, all players buy 100... HP o_O like nemsis xD
limit hp by cvar
thnx alll
Mikado is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 03-27-2013 , 06:53   Re: [REQ] Need plugin to limit health
Reply With Quote #2

Untested.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <fun>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Kia Armani"

new cvar_maxhp

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
cvar_maxhp register_cvar("mp_max","100")
    
set_task(1.0,"CheckPlayerHealth",0,"",0,"b")
}

public 
CheckPlayerHealth()
{
    new 
players[32], pnumtempid
    get_players
(playerspnum"a"); 
    for( new 
ii<pnumi++ ) 
    { 
        
tempid players[i];
        
        if(
get_user_health(tempid) > get_pcvar_num(cvar_maxhp))
        {
            
set_user_health(tempidget_pcvar_num(cvar_maxhp))
        }
    }

__________________
Kia is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 03-27-2013 , 09:09   Re: [REQ] Need plugin to limit health
Reply With Quote #3

Rather than a task, you could have used Health event ..
PHP Code:
#include <amxmodx>
#include <fun>

#define PLUGIN "Health Limit"
#define VERSION "1.0"
#define AUTHOR "Khalid :)"

new g_pHealth

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("Health""eHealth""b")
    
    
g_pHealth register_cvar("health_limit""150")
}

public 
eHealth(id)
{
    if(!
is_user_alive(id))
        return;
    
    static 
iHealth
    
if(get_user_health(id) > ( iHealth get_pcvar_num(g_pHealth) ) )
    {
        
set_user_health(idiHealth)
    }    

__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 03-27-2013 , 10:27   Re: [REQ] Need plugin to limit health
Reply With Quote #4

Didn't know that that event exists, thanks for advice.
__________________
Kia 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 19:37.


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