Raised This Month: $ Target: $400
 0% 

add max hp&ap check


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
dypz
Senior Member
Join Date: Mar 2009
Location: Belarus, Orsha
Old 01-06-2014 , 08:44   add max hp&ap check
Reply With Quote #1

Please add max hp and ap check controllable by cvars (max_ap and max_hp)

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

#define PLUGIN "New Plug-In"
#define VERSION "0.1"
#define AUTHOR "asdf"

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )
#define MAX_PLAYERS    32

new const Float:g_flCoords[][] = 
{
    {
0.500.40},
    {
0.560.44},
    {
0.600.50},
    {
0.560.56},
    {
0.500.60},
    {
0.440.56},
    {
0.400.50},
    {
0.440.44}
}

new 
g_iPlayerPos[MAX_PLAYERS+1]
new 
g_iMaxPlayers
new g_pCvarEnabled
new msgScreenFadeamx_kill_fade_amountcsdm_hpcsdm_ap

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
g_pCvarEnabled register_cvar("bullet_damage""1")
    
amx_kill_fade_amount register_cvar("amx_kill_fade_amount""150")
    
csdm_hp register_cvar("csdm_hp""15")
    
csdm_ap register_cvar("csdm_ap""15")
    
    
register_event("DeathMsg""death_event""a""1>0")
    
register_event("Damage""Event_Damage""b""2>0""3=0")

    
g_iMaxPlayers get_maxplayers()
    
    
msgScreenFade get_user_msgid("ScreenFade")
    
g_iMaxPlayers get_maxplayers()
}

public 
Event_DamageiVictim )
{
    if( 
get_pcvar_num(g_pCvarEnabled) && (read_data(4) || read_data(5) || read_data(6)) )
    {
        new 
id get_user_attacker(iVictim)
        if( (
<= id <= g_iMaxPlayers) && is_user_connected(id) && get_user_flags(id) & ADMIN_LEVEL_H )
        {
            new 
iPos = ++g_iPlayerPos[id]
            if( 
iPos == sizeof(g_flCoords) )
            {
                
iPos g_iPlayerPos[id] = 0
            
}
            
set_hudmessage(04080Float:g_flCoords[iPos][0], Float:g_flCoords[iPos][1], 00.12.50.020.02, -1)
            
show_hudmessage(id"%d"read_data(2))
        }
    }


public 
death_event()
{
    new 
iKiller read_data(1)

    if(
IsPlayer(iKiller) && is_user_alive(iKiller) && get_user_flags(iKiller) & ADMIN_LEVEL_H)
    {
        
fadegreen(iKillerget_pcvar_num(amx_kill_fade_amount))
        
set_user_health(iKillerget_user_health(iKiller) + get_pcvar_num(csdm_hp))
        
set_user_armor(iKillerget_user_armor(iKiller) + get_pcvar_num(csdm_ap))    
    }
}



stock fadegreen(idammount)
{    
    
//FADE OUT FROM GREEN
    
if (ammount 255)
    
ammount 255
    
    message_begin
(MSG_ONE_UNRELIABLEmsgScreenFade, {0,0,0}, id)
    
write_short(ammount 100)    //Durration
    
write_short(0)        //Hold
    
write_short(0)        //Type
    
write_byte(0)    //R
    
write_byte(0)    //G
    
write_byte(200)    //B
    
write_byte(ammount)    //B
    
message_end()

Thanks.
__________________


Last edited by dypz; 01-06-2014 at 08:46.
dypz is offline
Send a message via Skype™ to dypz
 



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 20:23.


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