Raised This Month: $51 Target: $400
 12% 

Solved Can someone fix this error?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RAW_192
Senior Member
Join Date: Feb 2017
Old 03-28-2017 , 09:55   Can someone fix this error?
Reply With Quote #1

PHP Code:
#include <amxmodx>  
#include <engine>  
#include <hamsandwich> 
#include <fakemeta_util> 

new have_nade[33

public 
plugin_init()  
{  
    
register_plugin("Granada""0.1""alan_el_more")  
    
register_touch("*""grenade""TouchGrenade"
    
RegisterHam(Ham_Think"grenade""fw_ThinkGrenade"
    
register_clcmd("say /touch""havenade")  
}  

public 
fw_ThinkGrenade(entity
{     
    if(!
pev_valid(entity)) 
        return 
HAM_IGNORED 
         
    
static Float:dmgtime     
    pev
(entitypev_dmgtimedmgtime
     
    if (
dmgtime get_gametime()) 
        return 
HAM_IGNORED     
     
    
static attacker 
    attacker 
pev(entitypev_owner
    
have_nade[attacker] = 
     
    
return HAM_IGNORED 
}  

public 
grenade_throw(idgreindexwId)  
{  
    if(
wId == CSW_HEGRENADE
    { 
    if(
have_nade[id]) 
        
entity_set_int(greindexEV_INT_iuser4CSW_HEGRENADE)  
    } 
}  

public 
TouchGrenade(touchedgrenade)  
{  
    if(
is_solid(touched) && entity_get_int(grenadeEV_INT_iuser4) == CSW_HEGRENADE)  
        
entity_set_float(grenadeEV_FL_dmgtime0.0)  
}  

public 
bool:is_solid(ent)  
{  
    return (
ent ? ((entity_get_int(entEV_INT_solid) > SOLID_TRIGGER) ? true false) : true)  


public 
havenade(id
{     
    if(
is_user_alive(id)) 
    { 
        
have_nade[id] = 
         
        
if(!user_has_weapon(idCSW_HEGRENADE)) 
            
fm_give_item(id"weapon_hegrenade"
    } 
     
    return 
PLUGIN_HANDLED 

     
public 
client_disconnect(id
    
have_nade[id] = 


This is the code by @Neon123


Im getting this error

Quote:
L 03/28/2017 - 089:22: Start of error session.
L 03/28/2017 - 089:22: Info (map "de_inferno") (file "addons/amxmodx/logs/error_20170328.log")
L 03/28/2017 - 089:22: [ENGINE] Invalid entity 288
L 03/28/2017 - 089:22: [AMXX] Displaying debug trace (plugin "proxy.amxx", version "1.0")
L 03/28/2017 - 089:22: [AMXX] Run time error 10: native error (native "entity_get_int")
L 03/28/2017 - 089:22: [AMXX] [0] atouchnade.sma::is_solid (line 51)
L 03/28/2017 - 089:22: [AMXX] [1] atouchnade.sma::TouchGrenade (line 45)

Last edited by RAW_192; 03-28-2017 at 12:57.
RAW_192 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-28-2017 , 11:14   Re: Can someone fix this error?
Reply With Quote #2

Code:
#include <amxmodx>    #include <engine>    #include <hamsandwich>  #include <fakemeta_util>  new have_nade[33]  public plugin_init()    {        register_plugin("Granada", "0.1", "alan_el_more")        register_touch("*", "grenade", "TouchGrenade")      RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")      register_clcmd("say /touch", "havenade")    }    public fw_ThinkGrenade(entity)  {          if(!pev_valid(entity))      return HAM_IGNORED          static Float:dmgtime          pev(entity, pev_dmgtime, dmgtime)          if (dmgtime > get_gametime())      return HAM_IGNORED              static attacker      attacker = pev(entity, pev_owner)      have_nade[attacker] = 0          return HAM_IGNORED  }    public grenade_throw(id, greindex, wId)    {        if(wId == CSW_HEGRENADE)      {          if(have_nade[id])          entity_set_int(greindex, EV_INT_iuser4, CSW_HEGRENADE)        }  }    public TouchGrenade(touched, grenade)    {        if(is_valid_ent(touched) && is_solid(touched) && entity_get_int(grenade, EV_INT_iuser4) == CSW_HEGRENADE)        entity_set_float(grenade, EV_FL_dmgtime, 0.0)    }    public bool:is_solid(ent)    {        return (ent ? ((entity_get_int(ent, EV_INT_solid) > SOLID_TRIGGER) ? true : false) : true)    }  public havenade(id)  {          if(is_user_alive(id))      {          have_nade[id] = 1                  if(!user_has_weapon(id, CSW_HEGRENADE))          fm_give_item(id, "weapon_hegrenade")      }          return PLUGIN_HANDLED  }  public client_disconnect(id)  have_nade[id] = 0
__________________
edon1337 is offline
RAW_192
Senior Member
Join Date: Feb 2017
Old 03-28-2017 , 11:51   Re: Can someone fix this error?
Reply With Quote #3

Thanks its solved

Last edited by RAW_192; 03-28-2017 at 12:19.
RAW_192 is offline
RAW_192
Senior Member
Join Date: Feb 2017
Old 03-28-2017 , 12:49   Re: Can someone fix this error?
Reply With Quote #4

Quote:
Originally Posted by edon1337 View Post
Code:
#include <amxmodx>    #include <engine>    #include <hamsandwich>  #include <fakemeta_util>  new have_nade[33]  public plugin_init()    {        register_plugin("Granada", "0.1", "alan_el_more")        register_touch("*", "grenade", "TouchGrenade")      RegisterHam(Ham_Think, "grenade", "fw_ThinkGrenade")      register_clcmd("say /touch", "havenade")    }    public fw_ThinkGrenade(entity)  {          if(!pev_valid(entity))      return HAM_IGNORED          static Float:dmgtime          pev(entity, pev_dmgtime, dmgtime)          if (dmgtime > get_gametime())      return HAM_IGNORED              static attacker      attacker = pev(entity, pev_owner)      have_nade[attacker] = 0          return HAM_IGNORED  }    public grenade_throw(id, greindex, wId)    {        if(wId == CSW_HEGRENADE)      {          if(have_nade[id])          entity_set_int(greindex, EV_INT_iuser4, CSW_HEGRENADE)        }  }    public TouchGrenade(touched, grenade)    {        if(is_valid_ent(touched) && is_solid(touched) && entity_get_int(grenade, EV_INT_iuser4) == CSW_HEGRENADE)        entity_set_float(grenade, EV_FL_dmgtime, 0.0)    }    public bool:is_solid(ent)    {        return (ent ? ((entity_get_int(ent, EV_INT_solid) > SOLID_TRIGGER) ? true : false) : true)    }  public havenade(id)  {          if(is_user_alive(id))      {          have_nade[id] = 1                  if(!user_has_weapon(id, CSW_HEGRENADE))          fm_give_item(id, "weapon_hegrenade")      }          return PLUGIN_HANDLED  }  public client_disconnect(id)  have_nade[id] = 0


Wait It works as a normal nade now .. There's something wrong
RAW_192 is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 03-28-2017 , 12:50   Re: Can someone fix this error?
Reply With Quote #5

Try changing
Code:
is_valid_ent(touched)
to
Code:
is_valid_ent(grenade)
__________________
edon1337 is offline
RAW_192
Senior Member
Join Date: Feb 2017
Old 03-28-2017 , 12:56   Re: Can someone fix this error?
Reply With Quote #6

Quote:
Originally Posted by edon1337 View Post
Try changing
Code:
is_valid_ent(touched)
to
Code:
is_valid_ent(grenade)
Yeah it worked thanks
RAW_192 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 23:51.


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