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

Suicide Bomb


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-08-2012 , 21:24   Suicide Bomb
Reply With Quote #1

I am trying to build a suicide bomb plugin for CTs. I can't get the suicide bomb to cause the damage it is supposed to. The task to initial the count down and the explosion is working fine. In the task I set:

PHP Code:
new Float:flOrigin[3];
get_user_origin(idflOrigin0); 
and I also call the function that is supposed to cause the damage

PHP Code:
fm_radius_damage(idflOriginget_pcvar_float(g_pSuicideDamage), get_pcvar_float(g_pSuicideRadius)); 
PHP Code:
stock fm_radius_damage(idorig[3], dmg rad
{
    new 
Health;
    static 
Ent
    Ent 
= -1
       
    
while((Ent engfunc(EngFunc_FindEntityInSphereEntorigrad))) 
    {
        if(
is_user_alive(Ent))
        {
            if(
cs_get_user_team(Ent) == CS_TEAM_T)
            {            
                
Health get_user_health(Ent);
                
Health -= dmg;
        
                if(
Health <= 0.0){
                    
user_kill(Ent);
                    
set_user_frags(Ent,get_user_frags(Ent) + 1);
                }
                
                else{
                    
set_user_health(EntHealth);
                }
            }
        }
    }

This is not working though. Sometime the other player might be standing right next to the suicide bomber and it wont even hurt him. Could anyone help me out? Thank you

Last edited by vitorrossi; 09-08-2012 at 21:31.
vitorrossi is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-08-2012 , 22:58   Re: Suicide Bomb
Reply With Quote #2

PHP Code:
new vOrigin[3];
get_user_origin(idvOrigin0); 
there shouldn't be float.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-08-2012 , 23:56   Re: Suicide Bomb
Reply With Quote #3

Thanks. Would this be correct or in this case I also don't need a float?

PHP Code:
new Float:vOrigin[3];
pev(idpev_originvOrigin); 

Last edited by vitorrossi; 09-09-2012 at 00:07.
vitorrossi is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 09-09-2012 , 02:55   Re: Suicide Bomb
Reply With Quote #4

That would be correct. Fakemeta native retrieve a float vector :-)
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-09-2012 , 20:08   Re: Suicide Bomb
Reply With Quote #5

Thank you
vitorrossi is offline
vitorrossi
Senior Member
Join Date: Apr 2012
Location: NY, USA
Old 09-10-2012 , 23:22   Re: Suicide Bomb
Reply With Quote #6

I ended up doing it this way

PHP Code:
stock fm_radius_damage(id,Float:flOrigin[3])
    {
        new 
szClassname[33];
        static 
Ent
        Ent 
= -1

        
while((Ent engfunc(EngFunc_FindEntityInSphereEntflOriginget_pcvar_float(g_pSuicideRadius)))) 
        {
            
pev(Ent,pev_classname,szClassname,32);
            if(
equali(szClassname"player")){
                if(
cs_get_user_team(Ent) == CS_TEAM_T){
                    
ExecuteHam(Ham_TakeDamage,Ent,2,id,get_pcvar_float(g_pSuicideDamage),DMG_GENERIC DMG_ALWAYSGIB)
                }
            }
        }
    } 
vitorrossi 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:30.


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