AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HAMSANDWICH] Entity out of range (https://forums.alliedmods.net/showthread.php?t=172380)

Kiske 11-19-2011 16:26

[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(
1sizeof(sWeaponEntNames); i++)
        if(
sWeaponEntNames[i][0]) RegisterHam(Ham_Weapon_PrimaryAttacksWeaponEntNames[i], "fw_Weapon_PrimaryAttack_Post"1);
}

public 
fw_Weapon_PrimaryAttack_Post(weapon)
{
    static 
id;
    
id get_pdata_cbase(weapon414); // Line 28
    
    
if(!pev_valid(id))
        return 
HAM_IGNORED;
    
    if(
is_user_alive(id))
        
entity_set_vector(idEV_VEC_punchangleFloat:{0.00.00.0});
    
    return 
HAM_IGNORED;



Error:
PHP Code:

L 11/18/2011 10:59:36Start of error session.
L 11/18/2011 10:59:36Info (map "zm_toxic_house") (file "addons/amxmodx/logs/error_20111118.log")
L 11/18/2011 10:59:36: [HAMSANDWICHEntity out of range (-1)
L 11/18/2011 10:59:36: [AMXXDisplaying debug trace (plugin "weap_recoil.amxx")
L 11/18/2011 10:59:36: [AMXXRun time error 10native error (native "get_pdata_cbase")
L 11/18/2011 10:59:36: [AMXX]    [0weap_recoil.sma::fw_Weapon_PrimaryAttack_Post (line 28

Line 28:
PHP Code:

id get_pdata_cbase(weapon414); 

Sometimes the number -1 changes to -1963275547 or 1709694128.


Thanks in advance!

Sylwester 11-19-2011 19:28

Re: [HAMSANDWICH] Entity out of range
 
try this:
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_xm1014""weapon_mac10",
    
"weapon_aug""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_deagle""weapon_sg552",
    
"weapon_ak47""weapon_p90"};
    
    for(new 
isizeof(sWeaponEntNames); i++)
        
RegisterHam(Ham_Weapon_PrimaryAttacksWeaponEntNames[i], "fw_Weapon_PrimaryAttack_Post"1);
}

public 
fw_Weapon_PrimaryAttack_Post(weapon)
{
    static 
id;
    
    if(!
pev_valid(weapon))
        return 
HAM_IGNORED;
        
    
id get_pdata_cbase(weapon414); // Line 28
    
    
if(is_user_alive(id))
        
entity_set_vector(idEV_VEC_punchangleFloat:{0.00.00.0});
    
    return 
HAM_IGNORED;



bibu 11-20-2011 05:59

Re: [HAMSANDWICH] Entity out of range
 
Check if pdata is valid:

http://www.amxmodx.org/funcwiki.php?go=func&id=1040

Kiske 11-20-2011 08:51

Re: [HAMSANDWICH] Entity out of range
 
I think it worked, I didn't throw this error at the moment.
Thanks!

Devil259 11-21-2011 07:26

Re: [HAMSANDWICH] Entity out of range
 
Code:
#include < hamsandwich >

:3


All times are GMT -4. The time now is 08:31.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.