[HAMSANDWICH] Entity out of range
Hi.
I have a plugin that give me an error sometimes... I dont know when the error comes but i think that is the problem that shut down my servers.
Code:
PHP Code:
#include <amxmodx> #include <fakemeta> #include <engine>
public plugin_init() { register_plugin("Weapon Recoil", "v1.0.0", "Kiske"); new const sWeaponEntNames[][] = {"", "weapon_p228", "", "weapon_scout", "weapon_hegrenade", "weapon_xm1014", "weapon_c4", "weapon_mac10", "weapon_aug", "weapon_smokegrenade", "weapon_elite", "weapon_fiveseven", "weapon_ump45", "weapon_sg550", "weapon_galil", "weapon_famas", "weapon_usp", "weapon_glock18", "weapon_awp", "weapon_mp5navy", "weapon_m249", "weapon_m3", "weapon_m4a1", "weapon_tmp", "weapon_g3sg1", "weapon_flashbang", "weapon_deagle", "weapon_sg552", "weapon_ak47", "weapon_knife", "weapon_p90"}; new i; for(i = 1; i < sizeof(sWeaponEntNames); i++) if(sWeaponEntNames[i][0]) RegisterHam(Ham_Weapon_PrimaryAttack, sWeaponEntNames[i], "fw_Weapon_PrimaryAttack_Post", 1); }
public fw_Weapon_PrimaryAttack_Post(weapon) { static id; id = get_pdata_cbase(weapon, 41, 4); // Line 28 if(!pev_valid(id)) return HAM_IGNORED; if(is_user_alive(id)) entity_set_vector(id, EV_VEC_punchangle, Float:{0.0, 0.0, 0.0}); return HAM_IGNORED; }
Error:
PHP Code:
L 11/18/2011 - 10:59:36: Start of error session. L 11/18/2011 - 10:59:36: Info (map "zm_toxic_house") (file "addons/amxmodx/logs/error_20111118.log") L 11/18/2011 - 10:59:36: [HAMSANDWICH] Entity out of range (-1) L 11/18/2011 - 10:59:36: [AMXX] Displaying debug trace (plugin "weap_recoil.amxx") L 11/18/2011 - 10:59:36: [AMXX] Run time error 10: native error (native "get_pdata_cbase") L 11/18/2011 - 10:59:36: [AMXX] [0] weap_recoil.sma::fw_Weapon_PrimaryAttack_Post (line 28)
Line 28:
PHP Code:
id = get_pdata_cbase(weapon, 41, 4);
Sometimes the number -1 changes to -1963275547 or 1709694128.
Thanks in advance!
|