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

Radius Damage Stock


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bogdyuttzu
Senior Member
Join Date: Dec 2009
Location: Romania
Old 07-29-2011 , 05:12   Radius Damage Stock
Reply With Quote #1

I try to convert the radius damage from valve sdk in amxx, i do it but i have a problem.
When the stock is called the server is block instantly and server use 99% cpu

This is the stock:

PHP Code:
stock RadiusDamage(Float:vecSrc[3], pevInflictorpevAttackerFloat:flDamageFloat:flRadiusiClassIgnorebitsDamageType)
{
    static 
pEntitytrbInWater;
    static 
Float:flAdjustedDamageFloat:falloff;
    static 
Float:vecSpot;
    
    if (
flRadius)
        
falloff flDamage flRadius;
    else
        
falloff 1.0;
    
    
tr create_tr2();
    
pEntity FM_NULLENT;
    
bInWater = (engfunc(EngFunc_PointContentsvecSrc) == CONTENTS_WATER);
    
    
vecSrc[2] += 1;// in case grenade is lying on the ground
    
    
if (!pevAttacker)
        
pevAttacker pevInflictor;
        
    
// iterate on all entities in the vicinity.
    
while((pEntity fm_find_ent_in_sphere(pEntityvecSrcflRadius)) != FM_NULLENT)
    {
        if (
pev(pEntitypev_takedamage) != DAMAGE_NO)
        {
            static 
Classify;
            
Classify ExecuteHamB(Ham_ClassifypEntity);
            
            
// UNDONE: this should check a damage mask, not an ignore
            
if (iClassIgnore != && Classify == iClassIgnore)
            {
// houndeyes don't hurt other houndeyes with their attack
                
continue;
            }

            
// blast's don't tavel into or out of water
            
if (bInWater && pev(pEntitypev_waterlevel) == 0)
                continue;
                
            if (!
bInWater && pev(pEntitypev_waterlevel) == 3)
                continue;

            
ExecuteHamB(Ham_BodyTargetpEntityvecSrcvecSpot);
            
            
engfunc(EngFunc_TraceLinevecSrcvecSpotDONT_IGNORE_MONSTERSpevInflictortr);
            
            static 
Float:flFractionpHitfStartSolidFloat:vecEndPos[3];
            
get_tr2(trTR_flFractionflFraction);
            
get_tr2(trTR_pHitpHit);
            
get_tr2(trTR_StartSolidfStartSolid);
            
            if (
flFraction == 1.0 || pHit == pEntity)
            {
// the explosion can 'see' this entity, so hurt them!
                
                
if (fStartSolid)
                {
                    
// if we're stuck inside them, fixup the position and distance
                    
set_tr2(trTR_vecEndPosvecSrc)
                    
set_tr2(trTR_flFraction0.0)
                }
                
                
// decrease damage for an ent that's farther from the bomb.
                
get_tr2(trTR_vecEndPosvecEndPos);
                
xs_vec_sub(vecSrcvecEndPosvecEndPos);
                
                
flAdjustedDamage xs_vec_len(vecEndPos) * falloff
                flAdjustedDamage 
flDamage flAdjustedDamage;
            
                if (
flAdjustedDamage 0)
                {
                    
flAdjustedDamage 0.0;
                }

                if (
flFraction != 1.0)
                {
                    
get_tr2(trTR_vecEndPosvecEndPos);
                    
xs_vec_sub(vecEndPosvecSrcvecSrc);
                    
xs_vec_normalize(vecSrcvecSrc);
                    
                    
ExecuteHamB(Ham_TraceAttackpEntitypevInflictorflAdjustedDamagevecSrctrbitsDamageType);
                    
ExecuteHamB(Ham_TakeDamagepEntitypevInflictorpevAttackerflAdjustedDamagebitsDamageType);
                }
                else
                {
                    
ExecuteHamB(Ham_TakeDamagepEntitypevInflictorpevAttackerflAdjustedDamagebitsDamageType);
                }
            }
        }
    }
    
free_tr2(tr);

bogdyuttzu is offline
Send a message via Yahoo to bogdyuttzu
Old 07-29-2011, 06:46
bogdyuttzu
This message has been deleted by Exolent[jNr]. Reason: Don't bump until 2 weeks have passed since last post.
avril-lavigne
Banned
Join Date: Apr 2009
Old 07-29-2011 , 07:21   Re: Radius Damage Stock
Reply With Quote #2

yesterday I made plugin using radius damage

look for deagle nail launcher. U can take code from there
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 07-29-2011 , 07:36   Re: Radius Damage Stock
Reply With Quote #3

Or look lasermine, bazooka plugins
.Dare Devil. is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 07-29-2011 , 08:25   Re: Radius Damage Stock
Reply With Quote #4

Last night i also searching for radius damage stock and i found this 1 by OT:
PHP Code:
stock HamRadiusDamage(entFloat:radiusFloat:damagebits

    new 
target = -1Float:origin[3
    
pev(entpev_originorigin
     
    while(( 
target find_ent_in_sphere(targetoriginradius) )) 
    { 
        static 
Float:o[3
        
pev(targetpev_origino
         
        
xs_vec_sub(originoo
         
        
// Recheck if the entity is in radius 
        
if (xs_vec_len(o) > radius
            continue 
         
        
Ham_ExecDamageB(targetentpev(entpev_owner), damage * (xs_vec_len(o) / radius), HIT_GENERICbits
    } 

remember to define these 2 include in your sma:
PHP Code:
#include <hamsandwich>
#include <xs> 
Didn't test yet but i think it working.
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
bogdyuttzu
Senior Member
Join Date: Dec 2009
Location: Romania
Old 07-29-2011 , 08:37   Re: Radius Damage Stock
Reply With Quote #5

OK tnx all but i need my radius damage because have trace attack
bogdyuttzu is offline
Send a message via Yahoo to bogdyuttzu
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-29-2011 , 09:31   Re: Radius Damage Stock
Reply With Quote #6

Have you tried at least to debug yourself ? To see where it crashes. Random guess, Ham_BodyTarget.
__________________
Arkshine is offline
bogdyuttzu
Senior Member
Join Date: Dec 2009
Location: Romania
Old 07-29-2011 , 10:04   Re: Radius Damage Stock
Reply With Quote #7

i don't think is Ham_BodyTarget the problem because i use this ham
http://forums.alliedmods.net/showthread.php?t=159814

Last edited by bogdyuttzu; 07-29-2011 at 10:20.
bogdyuttzu is offline
Send a message via Yahoo to bogdyuttzu
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-29-2011 , 10:55   Re: Radius Damage Stock
Reply With Quote #8

Instead of guessing, debug and see from where it crashes.
__________________
Arkshine is offline
bogdyuttzu
Senior Member
Join Date: Dec 2009
Location: Romania
Old 07-29-2011 , 11:36   Re: Radius Damage Stock
Reply With Quote #9

OK and... how i can debug?

Its don't show errors in console because is complect freeze

Last edited by bogdyuttzu; 07-29-2011 at 11:39.
bogdyuttzu is offline
Send a message via Yahoo to bogdyuttzu
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-29-2011 , 11:39   Re: Radius Damage Stock
Reply With Quote #10

Add debug text, check value and such.
__________________
Arkshine 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 04:16.


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