Hi, I am trying to make a VIP/ADMINS exclusive plugin for our fun server and it does work but meanwhile it generates errorlogs about get_user_weapon() function.
Can someone take a look at the code about what's wrong?
Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define ACCESS ADMIN_CFG
#define VERSION "0.2"
new damageMultiplier
new Float:dmgRate
new clip, ammo
public plugin_init()
{
register_plugin("VIP Sebzes Bonusz", VERSION, "RaZ")
damageMultiplier = register_cvar("vipbonus_dmgrate", "1.3")
RegisterHam(Ham_TakeDamage, "player", "fw_TakeDamage")
}
public fw_TakeDamage(victim, inflictor, attacker, Float:damage)
{
dmgRate = get_pcvar_float(damageMultiplier)
new iWeapon = get_user_weapon(attacker, clip, ammo)
new playerCount = get_maxplayers()
if(attacker > playerCount)
return PLUGIN_CONTINUE
if(attacker < 1)
return PLUGIN_CONTINUE
if(!attacker)
return PLUGIN_CONTINUE
if (is_user_connected(attacker) && is_user_alive(attacker) && get_user_flags(attacker) & ACCESS)
{
new iWeaponUsed = get_user_weapon(inflictor)
if(iWeapon == CSW_KNIFE || iWeapon == CSW_AWP || iWeapon == CSW_SCOUT || iWeaponUsed == CSW_HEGRENADE)
return PLUGIN_CONTINUE
SetHamParamFloat(4, damage * dmgRate)
}
return HAM_HANDLED
}
Detailed error log:
Quote:
L 11/01/2015 - 19:25:15: Start of error session.
L 11/01/2015 - 19:25:15: Info (map "cs_iraq") (file "addons/amxmodx/logs/error_20151101.log")
L 11/01/2015 - 19:25:15: Invalid player id 154
L 11/01/2015 - 19:25:15: [AMXX] Displaying debug trace (plugin "vipdmgbonus.amxx", version "0.2")
L 11/01/2015 - 19:25:15: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 11/01/2015 - 19:25:15: [AMXX] [0] vipdmgbonus.sma::fw_TakeDamage (line 23)
L 11/01/2015 - 19:25:15: Invalid player id 155
L 11/01/2015 - 19:25:15: [AMXX] Displaying debug trace (plugin "vipdmgbonus.amxx", version "0.2")
L 11/01/2015 - 19:25:15: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 11/01/2015 - 19:25:15: [AMXX] [0] vipdmgbonus.sma::fw_TakeDamage (line 23)
L 11/01/2015 - 19:25:15: Invalid player id 156
L 11/01/2015 - 19:25:15: [AMXX] Displaying debug trace (plugin "vipdmgbonus.amxx", version "0.2")
L 11/01/2015 - 19:25:15: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 11/01/2015 - 19:25:15: [AMXX] [0] vipdmgbonus.sma::fw_TakeDamage (line 23)
L 11/01/2015 - 19:25:15: Invalid player id 329
L 11/01/2015 - 19:25:15: [AMXX] Displaying debug trace (plugin "vipdmgbonus.amxx", version "0.2")
L 11/01/2015 - 19:25:15: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 11/01/2015 - 19:25:15: [AMXX] [0] vipdmgbonus.sma::fw_TakeDamage (line 23)
L 11/01/2015 - 19:25:28: Invalid player id -1
L 11/01/2015 - 19:25:28: [AMXX] Displaying debug trace (plugin "vipdmgbonus.amxx", version "0.2")
L 11/01/2015 - 19:25:28: [AMXX] Run time error 10: native error (native "get_user_weapon")
L 11/01/2015 - 19:25:28: [AMXX] [0] vipdmgbonus.sma::fw_TakeDamage (line 23)
|