i need some help with fm!!

Questions, on how to perform AMXX scripting, are inside of this forum.
User avatar
Archive-Poster
Posts: 1180
Gender:
United States of America

i need some help with fm!!

Post by Archive-Poster »

ok well im porting this plugin and they have this engine func

Code: Select all

radius_damage(nade, 108.0, fexplosion, 360.0, DMG_BLAST, "grenade", 0)
but i want to use fm so here is what i did
i added this to my plugin

Code: Select all

stock fm_radius_damage(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier)
{
 new pSearchEnt;
 while( (pSearchEnt = engfunc(EngFunc_FindEntityInSphere,pSearchEnt, fExplodeAt, 5 * iRadiusMultiplier) ) != 0) 
 {
  if(! (pev(pSearchEnt,pev_takedamage) & (1<<6)) ) 
  {
   new hp = pev(pSearchEnt,pev_health) - (10 + random_num(0,3) * iDamageMultiplier);
   set_pev(pSearchEnt,pev_health,hp);
   
   if(hp < 1) if(is_user_alive(pSearchEnt) ) dllfunc(DLLFunc_ClientKill,pSearchEnt)
  }
 }
 
 while( (pSearchEnt = engfunc(EngFunc_FindEntityInSphere,pSearchEnt, fExplodeAt, 4 * iRadiusMultiplier) ) != 0) 
 {
  if(! (pev(pSearchEnt,pev_takedamage) & (1<<6)) ) 
  {
   new hp = pev(pSearchEnt,pev_health) - (25 + random_num(0,3) * iDamageMultiplier);
   set_pev(pSearchEnt,pev_health,hp);
   
   if(hp < 1) if(is_user_alive(pSearchEnt) ) dllfunc(DLLFunc_ClientKill,pSearchEnt)
  }
 }
 
 while( (pSearchEnt = engfunc(EngFunc_FindEntityInSphere,pSearchEnt, fExplodeAt, 3 * iRadiusMultiplier) ) != 0) 
 {
  if(! (pev(pSearchEnt,pev_takedamage) & (1<<6)) ) 
  {
   new hp = pev(pSearchEnt,pev_health) - (50 + random_num(0,3) * iDamageMultiplier);
   set_pev(pSearchEnt,pev_health,hp);
   
   if(hp < 1) if(is_user_alive(pSearchEnt) ) dllfunc(DLLFunc_ClientKill,pSearchEnt)
  }
 }
 
 while( (pSearchEnt = engfunc(EngFunc_FindEntityInSphere,pSearchEnt, fExplodeAt, 2 * iRadiusMultiplier) ) != 0) 
 {
  if(! (pev(pSearchEnt,pev_takedamage) & (1<<6)) ) if(is_user_alive(pSearchEnt) ) dllfunc(DLLFunc_ClientKill,pSearchEnt)
 }
 
 return 1;
}
and change the radius_damage to fm_radius_damge could someone tell me what im i doing wrong teame06 said something about origin but i didn't understand..
User avatar
Archive-Poster
Posts: 1180
Gender:
United States of America

Re: i need some help with fm!!

Post by Archive-Poster »

This is how i did it (i didn't looked at your code)

Code: Select all

stock fm_radius_damage(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier) {
    new ent = 0
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(5 * iRadiusMultiplier))) > 0) {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) {
            new Float:plHealth 
            pev(ent, pev_health, plHealth)
            
            plHealth - 10.0 + random_float(0, 1 * iDamageMultiplier)
            
            if (plHealth < 1) {
                user_kill(ent)
            } else {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }
    
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(4 * iRadiusMultiplier))) > 0) {        
        if (is_user_alive(ent)) && !fm_get_user_godmode(ent)) {
            new Float:plHealth 
            pev(ent, pev_health, plHealth)
            
            plHealth - 25.0 + random_float(0, 2 * iDamageMultiplier)
            
            if (plHealth < 1) {
                user_kill(ent)
            } else {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }
    
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(3 * iRadiusMultiplier))) > 0) {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) {
            new Float:plHealth
            pev(ent, pev_health, plHealth)
            
            plHealth - 50.0 + random_float(0, 3 * iDamageMultiplier)
            
            if (plHealth < 1) {
                user_kill(ent)
            } else {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }
    
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(2 * iRadiusMultiplier))) > 0) {
        if (is_user_alive(ent) && !fm_get_user_godmode(ent))
            user_kill(ent)
    }
    
}
User avatar
Archive-Poster
Posts: 1180
Gender:
United States of America

Re: i need some help with fm!!

Post by Archive-Poster »

Works perfect, like a charm. No errors in compiling and no run time errors from server.

Though I did have to edit it just a bit but yeah.....works fine.

Code: Select all

stock fm_radius_damage(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier) 
    {
    new ent = 0
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(5 * iRadiusMultiplier))) > 0) 
        {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) 
            {
            new Float:plHealth 
            pev(ent, pev_health, plHealth)
            
            plHealth - 10.0 + iDamageMultiplier
            
            if (plHealth < 1) 
                {
                user_kill(ent)
            } 
            else 
                {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }   
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(4 * iRadiusMultiplier))) > 0) 
        {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) 
            {
            new Float:plHealth 
            pev(ent, pev_health, plHealth)
            
            plHealth - 25.0 + random_num(0, 2 * iDamageMultiplier)
            
            if (plHealth < 1) 
                {
                user_kill(ent)
            } 
            else 
                {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }   
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(3 * iRadiusMultiplier))) > 0) 
        {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) 
            {
            new Float:plHealth
            pev(ent, pev_health, plHealth)
            
            plHealth - 50.0 + random_num(0, 3 * iDamageMultiplier)
            
            if (plHealth < 1) 
                {
                user_kill(ent)
            } 
            else 
                {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }   
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(2 * iRadiusMultiplier))) > 0) 
        {
        if (is_user_alive(ent) && !fm_get_user_godmode(ent))
            {
            user_kill(ent)
        }
    }
    
}
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests