Raised This Month: $ Target: $400
 0% 

[HAMSANDWICH] Entity out of range


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kiske
Veteran Member
Join Date: May 2009
Old 11-19-2011 , 16:26   [HAMSANDWICH] Entity out of range
Reply With Quote #1

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!

Last edited by Kiske; 11-19-2011 at 16:27.
Kiske is offline
Send a message via Skype™ to Kiske
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 11-19-2011 , 19:28   Re: [HAMSANDWICH] Entity out of range
Reply With Quote #2

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;

__________________
Impossible is Nothing

Last edited by Sylwester; 11-19-2011 at 19:29.
Sylwester is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 11-20-2011 , 05:59   Re: [HAMSANDWICH] Entity out of range
Reply With Quote #3

Check if pdata is valid:

http://www.amxmodx.org/funcwiki.php?go=func&id=1040
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.

Last edited by bibu; 11-20-2011 at 06:00.
bibu is offline
Kiske
Veteran Member
Join Date: May 2009
Old 11-20-2011 , 08:51   Re: [HAMSANDWICH] Entity out of range
Reply With Quote #4

I think it worked, I didn't throw this error at the moment.
Thanks!
Kiske is offline
Send a message via Skype™ to Kiske
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 11-21-2011 , 07:26   Re: [HAMSANDWICH] Entity out of range
Reply With Quote #5

Code:
#include < hamsandwich >

Devil259 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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