Иконка ресурса

reapi Damage Control 0.1

Нет прав для скачивания
Автор
Flymic24
Исходный код
Perl:
#include < amxmodx >
#include < hamsandwich >
#include < reapi >

new Float:g_eCvar[MAX_WEAPONS - 1];

public plugin_init() {
    register_plugin
    (
        "[AMXX] Weapon Damage Control",
        "0.1",
        "Flymic24"
    );
    
    bind_pcvar_float(create_cvar("amx_dmg_p228", "1.0", .description = "damage p228: 0.0 - Disable", .has_min = true), g_eCvar[CSW_P228]);
    bind_pcvar_float(create_cvar("amx_dmg_scout", "1.0", .description = "damage scout: 0.0 - Disable", .has_min = true), g_eCvar[CSW_SCOUT]);
    bind_pcvar_float(create_cvar("amx_dmg_xm1014", "1.0", .description = "damage xm1014: 0.0 - Disable", .has_min = true), g_eCvar[CSW_XM1014]);
    bind_pcvar_float(create_cvar("amx_dmg_mac10", "1.0", .description = "damage mac10: 0.0 - Disable", .has_min = true), g_eCvar[CSW_MAC10]);
    bind_pcvar_float(create_cvar("amx_dmg_aug", "1.0", .description = "damage aug: 0.0 - Disable", .has_min = true), g_eCvar[CSW_AUG]);
    bind_pcvar_float(create_cvar("amx_dmg_elite", "1.0", .description = "damage elite: 0.0 - Disable", .has_min = true), g_eCvar[CSW_ELITE]);
    bind_pcvar_float(create_cvar("amx_dmg_fiveseven", "1.0", .description = "damage fiveseven: 0.0 - Disable", .has_min = true), g_eCvar[CSW_FIVESEVEN]);
    bind_pcvar_float(create_cvar("amx_dmg_ump45", "1.0", .description = "damage ump45: 0.0 - Disable", .has_min = true), g_eCvar[CSW_UMP45]);
    bind_pcvar_float(create_cvar("amx_dmg_sg550", "1.0", .description = "damage sg550: 0.0 - Disable", .has_min = true), g_eCvar[CSW_SG550]);
    bind_pcvar_float(create_cvar("amx_dmg_galil", "1.0", .description = "damage galil: 0.0 - Disable", .has_min = true), g_eCvar[CSW_GALIL]);
    bind_pcvar_float(create_cvar("amx_dmg_famas", "1.0", .description = "damage famas: 0.0 - Disable", .has_min = true), g_eCvar[CSW_FAMAS]);
    bind_pcvar_float(create_cvar("amx_dmg_usp", "1.0", .description = "damage usp: 0.0 - Disable", .has_min = true), g_eCvar[CSW_USP]);
    bind_pcvar_float(create_cvar("amx_dmg_glock18", "1.0", .description = "damage glock18: 0.0 - Disable", .has_min = true), g_eCvar[CSW_GLOCK18]);
    bind_pcvar_float(create_cvar("amx_dmg_awp", "1.0", .description = "damage awp: 0.0 - Disable", .has_min = true), g_eCvar[CSW_AWP]);
    bind_pcvar_float(create_cvar("amx_dmg_mp5navy", "1.0", .description = "damage mp5navy: 0.0 - Disable", .has_min = true), g_eCvar[CSW_MP5NAVY]);
    bind_pcvar_float(create_cvar("amx_dmg_m249", "1.0", .description = "damage m249: 0.0 - Disable", .has_min = true), g_eCvar[CSW_M249]);
    bind_pcvar_float(create_cvar("amx_dmg_m3", "1.0", .description = "damage m3: 0.0 - Disable", .has_min = true), g_eCvar[CSW_M3]);
    bind_pcvar_float(create_cvar("amx_dmg_m4a1", "1.0", .description = "damage m4a1: 0.0 - Disable", .has_min = true), g_eCvar[CSW_M4A1]);
    bind_pcvar_float(create_cvar("amx_dmg_tmp", "1.0", .description = "damage tmp: 0.0 - Disable", .has_min = true), g_eCvar[CSW_TMP]);
    bind_pcvar_float(create_cvar("amx_dmg_g3sg1", "1.0", .description = "damage g3sg1: 0.0 - Disable", .has_min = true), g_eCvar[CSW_G3SG1]);
    bind_pcvar_float(create_cvar("amx_dmg_deagle", "1.0", .description = "damage deagle: 0.0 - Disable", .has_min = true), g_eCvar[CSW_DEAGLE]);
    bind_pcvar_float(create_cvar("amx_dmg_sg552", "1.0", .description = "damage sg552: 0.0 - Disable", .has_min = true), g_eCvar[CSW_SG552]);
    bind_pcvar_float(create_cvar("amx_dmg_ak47", "1.0", .description = "damage ak47: 0.0 - Disable", .has_min = true), g_eCvar[CSW_AK47]);
    bind_pcvar_float(create_cvar("amx_dmg_knife", "1.0", .description = "damage knife: 0.0 - Disable", .has_min = true), g_eCvar[CSW_KNIFE]);
    bind_pcvar_float(create_cvar("amx_dmg_p90", "1.0", .description = "damage p90: 0.0 - Disable", .has_min = true), g_eCvar[CSW_P90]);
    
    AutoExecConfig(true, "weapon_damage_control");
    
    const IGNORE_WEAPON = 1<<CSW_HEGRENADE|1<<CSW_SMOKEGRENADE|1<<CSW_FLASHBANG|1<<CSW_C4|1<<CSW_GLOCK;
    
    for (new szWeaponName[MAX_NAME_LENGTH], iWeaponID = 1; iWeaponID < MAX_WEAPONS - 1; iWeaponID++)    {
        if (!((1<<iWeaponID) & IGNORE_WEAPON))    {
            get_weaponname(iWeaponID, szWeaponName, charsmax(szWeaponName));
            RegisterHam(Ham_Spawn, szWeaponName, "Ham_Weapon_Spawn_Post", .Post = true);
        }
    }
}

public Ham_Weapon_Spawn_Post(const iWeapon)    {
    if (get_entvar(iWeapon, var_impulse))        //    Ignore Custom Weapon
        return HAM_IGNORED;
    
    new iWeaponID = get_member(iWeapon, m_iId);
    
    set_member(iWeapon, m_Weapon_flBaseDamage, Float:get_member(iWeapon, m_Weapon_flBaseDamage) * g_eCvar[iWeaponID]);
    
    switch(iWeaponID)    {
        case CSW_M4A1:    {
            set_member(iWeapon, m_M4A1_flBaseDamageSil, Float:get_member(iWeapon, m_M4A1_flBaseDamageSil) * g_eCvar[iWeaponID]);
        }
        case CSW_USP:    {
            set_member(iWeapon, m_USP_flBaseDamageSil, Float:get_member(iWeapon, m_USP_flBaseDamageSil) * g_eCvar[iWeaponID]);
        }
        case CSW_FAMAS:    {
            set_member(iWeapon, m_Famas_flBaseDamageBurst, Float:get_member(iWeapon, m_Famas_flBaseDamageBurst) * g_eCvar[iWeaponID]);
        }
        case CSW_KNIFE:    {
            set_member(iWeapon, m_Knife_flStabBaseDamage, Float:get_member(iWeapon, m_Knife_flStabBaseDamage) * g_eCvar[iWeaponID]);
            set_member(iWeapon, m_Knife_flSwingBaseDamage, Float:get_member(iWeapon, m_Knife_flSwingBaseDamage) * g_eCvar[iWeaponID]);
            set_member(iWeapon, m_Knife_flSwingBaseDamage_Fast, Float:get_member(iWeapon, m_Knife_flSwingBaseDamage_Fast) * g_eCvar[iWeaponID]);
        }
    }
    
    return HAM_IGNORED;
}
Требования
ReAPI
Поддержка русского языка
Да
Совместимость
  1. REHLDS
Сверху Снизу