Quote:
Originally Posted by hjkwe654
CSWM will conflict with other plugins and cause server crash
Spoiler
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_TakeDamage, id, "KnifeDamage_BOT") g_hambots = true }
public RPGx_OnPluginReady() upgrade_id = RPGx_MakeUpgrade("近戰訓練", 100, 15, 7)
public KnifeDamage(this, id, attacker, Float:fDmg, damagebits) { if(is_user_alive(attacker)){ new iLevel = RPGx_GetUpgradeLevel(attacker, upgrade_id) if(iLevel && get_user_weapon(attacker) == CSW_KNIFE) { SetHamParamFloat(4, fDmg * (1 + dmgcalc)) //this code will conflict with CSWM return HAM_HANDLED } } return HAM_IGNORED }
public KnifeDamage_BOT(this, id, attacker, Float:fDmg, damagebits) { if(is_user_alive(attacker)){ new iLevel = RPGx_GetUpgradeLevel(attacker, upgrade_id) if(iLevel && get_user_weapon(attacker) == CSW_KNIFE) { SetHamParamFloat(4, fDmg + (iLevel * 0.08)) //this code will conflict with CSWM return HAM_HANDLED } } return HAM_IGNORED }
|
Thanks for report, i have fixed the issue, problem was not SetHamParamFloat, it was caused after restarting the game and shooting bot.
Your code is incorrect at:
Code:
if (!is_user_bot(id) && g_hambots && !cvar_botquota)
return
should be:
Code:
if (!is_user_bot(id) || g_hambots || !cvar_botquota)
return
If you face any issues please report here or on github page.
__________________