AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   add max hp&ap check (https://forums.alliedmods.net/showthread.php?t=232890)

dypz 01-06-2014 08:44

add max hp&ap check
 
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.


All times are GMT -4. The time now is 20:23.

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