This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Grenade think 2 calls


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 11-18-2014 , 11:52   Grenade think 2 calls
Reply With Quote #1

PHP Code:

public fw_think(ent)

    static 
Float:dmgtime
         pev
(entpev_dmgtimedmgtime)     
    if (
dmgtime get_gametime()) return HAM_IGNORED
    
          
    
if(is_he(ent))
    {      
           
server_print("HE THINK")
      
heowner get_pdata_int(ent414
      static 
Float:or[3]
      
pev(ent,pev_origin,or)
      new 
target = -1
      
static  Float:flDistanceFloat:flDamage
      
while(( target find_ent_in_sphere(target, or, grenadelvl[heowner]*50.0) ))  
           {  
                     if(!
alive(target)) continue            
             
            
flDistance entity_range(enttarget );
                    
flDamage UTIL_FloatRadius100.0grenadelvl[heowner]*50.0flDistance );            
            
ExecuteHamB(Ham_TakeDamagetargetentheowner flDamage /* flDamage/protectlvl[target] */ DMG_GRENADE
            
server_print("radius %.2f damage %.2f"grenadelvl[heowner]*50.0flDamage)            
            }
        
        }
       

Debug says it called 2 times. how call it once at grenade explosion moment
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 11-18-2014 at 13:57.
avril-lavigne is offline
Old 11-18-2014, 12:01
Jhob94
This message has been deleted by Jhob94. Reason: nvm
Old 11-18-2014, 12:07
Fr33m@n
This message has been deleted by Fr33m@n. Reason: nvm
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 11-18-2014 , 18:25   Re: Grenade think 2 calls
Reply With Quote #2

¿What?
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 11-19-2014 , 04:33   Re: Grenade think 2 calls
Reply With Quote #3

Full plugin? Or maybe is the same problem as you had with damage and you must name the entity to something else.
__________________
Jhob94 is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 11-19-2014 , 16:09   Re: Grenade think 2 calls
Reply With Quote #4

just part

PHP Code:
RegisterHam(Ham_TakeDamage"player""fw_takedamage_pre",0)
RegisterHam(Ham_Think"grenade""fw_think")
register_forward(FM_SetModel,"fw_setmodel",1);


public 
fw_takedamage_previc iInflictor att Float:DamagebitsDamageType )
if( 
bitsDamageType DMG_GRENADE )  SetHamParamFloat(40.0)   // we have our custom dmg 

public fw_setmodel(ent,model[])
{       
    if(
equal(model"models/w_hegrenade.mdl"))
    
set_pdata_int(ent41pev(entpev_owner), 4)
    
    return 
FMRES_SUPERCEDE
}


public 
fw_think(ent)

    static 
Float:dmgtime
        pev
(entpev_dmgtimedmgtime
    
    if (
dmgtime get_gametime()) return HAM_IGNORED    
    
    
if(is_flash(ent))        
    
flashowner get_pdata_int(ent414) , flash ent    
      
    
if(is_he(ent))
    {
             
server_print("HE THINK")      
         
heowner get_pdata_int(ent414
         static 
Float:or[3]
         
pev(ent,pev_origin,or)
         new 
target = -1
         
static  Float:flDistanceFloat:flDamage
         
while(( target find_ent_in_sphere(target, or, grenadelvl[heowner]*50.0) ))  
             {  
                   if(!
alive(target)) continue       
             
           
flDistance entity_range(enttarget );
                   
flDamage UTIL_FloatRadius100.0grenadelvl[heowner]*50.0flDistance );            
           
ExecuteHamB(Ham_TakeDamagetargetentheowner ,  flDamage DMG_CLUB)
 
           
server_print("radius %.2f damage %.2f"grenadelvl[heowner]*50.0flDamage)            
             }        
         }
        return 
HAM_IGNORED    
}

public 
bool:is_he(ent)
{
    static 
model[32]
    
pev(entpev_modelmodel31)
    return 
bool:(containi(model"w_hegrenade.mdl") != -1)

In a moment of HE explosion I want to make damage once. I dont know why after throwing HE grenade right in explosion moment I see
debug message server_print("HE THINK") two times ....Therefore I suppose my radius damage also calculates two times

also I ask someone fix UTIL_FloatRadius because it calculates wrong radius damage im sure 100% .
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 11-19-2014 at 16:16.
avril-lavigne is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 11-19-2014 , 17:01   Re: Grenade think 2 calls
Reply With Quote #5

after execute the damage(out of the loop), set whatever value to non-used entity constants like EV_ENT_euser1

entity_set_edict(ent, EV_ENT_euser1, 521)

and before execute it, make an easy check
if(is_he(ent) && entity_get_edict(ent, EV_ENT_euser1) =! 521)

Last edited by baneado; 11-19-2014 at 17:04.
baneado is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 11-21-2014 , 15:08   Re: Grenade think 2 calls
Reply With Quote #6

I solved it to set he owner to 0 after loop

PHP Code:


if(is_he(ent) && heowner 0)

    
//  than



  
while(( target find_ent_in_sphere(target, or, grenadelvl[heowner]*50.0) ))  
  {  
   
  }              
       
set_pev(ent,pev_owner0)  // here 
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 11-21-2014 at 15:09.
avril-lavigne is offline
baneado
Veteran Member
Join Date: Dec 2012
Location: amxmodx-es.com
Old 11-22-2014 , 09:24   Re: Grenade think 2 calls
Reply With Quote #7

doing that maybe you can have problems with others plugins. think about it
baneado 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 00:14.


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