AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Suicide Bomb (https://forums.alliedmods.net/showthread.php?t=195548)

vitorrossi 09-08-2012 21:24

Suicide Bomb
 
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

Alka 09-08-2012 22:58

Re: Suicide Bomb
 
PHP Code:

new vOrigin[3];
get_user_origin(idvOrigin0); 

there shouldn't be float.

vitorrossi 09-08-2012 23:56

Re: Suicide Bomb
 
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); 


Alka 09-09-2012 02:55

Re: Suicide Bomb
 
That would be correct. Fakemeta native retrieve a float vector :-)

vitorrossi 09-09-2012 20:08

Re: Suicide Bomb
 
Thank you

vitorrossi 09-10-2012 23:22

Re: Suicide Bomb
 
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)
                }
            }
        }
    } 



All times are GMT -4. The time now is 08:17.

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