View Single Post
hjkwe654
Member
Join Date: Sep 2005
Location: Taiwan
Old 09-09-2018 , 01:45   Re: Module: Counter-Strike Weapon Mod [1.6 R]
Reply With Quote #17

CSWM will conflict with other plugins and cause server crash

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

#define dmgcalc (0.04 * RPGx_GetUpgradeLevel(attacker, upgrade_id))

new g_hambots
new cvar_botquota
new upgrade_id

public plugin_init() {
    
register_plugin("Knife Dmg+ RPGx Upgrade""2.7""hjkwe654")
    
cvar_botquota get_cvar_pointer("bot_quota")
    
RegisterHam(Ham_TakeDamage"player""KnifeDamage")
}

public 
client_putinserver(id) {
    if (!
is_user_bot(id) && g_hambots && !cvar_botquota)
        return
    
    
set_task(0.1"fw_RegisterHamBots"id)
}

public 
fw_RegisterHamBots(id) {
    
RegisterHamFromEntity(Ham_TakeDamageid"KnifeDamage_BOT")
    
g_hambots true
}

public 
RPGx_OnPluginReady()
    
upgrade_id RPGx_MakeUpgrade("近戰訓練"100157)

public 
KnifeDamage(thisidattackerFloat:fDmgdamagebits) {
    if(
is_user_alive(attacker)){
        new 
iLevel RPGx_GetUpgradeLevel(attackerupgrade_id)
        if(
iLevel && get_user_weapon(attacker) == CSW_KNIFE)
        {
            
SetHamParamFloat(4fDmg * (dmgcalc))   //this code will conflict with CSWM
            
return HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED
}

public 
KnifeDamage_BOT(thisidattackerFloat:fDmgdamagebits) {
    if(
is_user_alive(attacker)){
        new 
iLevel RPGx_GetUpgradeLevel(attackerupgrade_id)
        if(
iLevel && get_user_weapon(attacker) == CSW_KNIFE)
        {
            
SetHamParamFloat(4fDmg + (iLevel 0.08))   //this code will conflict with CSWM
            
return HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

hjkwe654 is offline