AlliedModders

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

Jhob94 09-13-2013 19:50

Grenades...
 
Hi
I have 3 questions. It might be request but if tell me how with good examples i think is enough :wink:

First: (all nades)
- Making the grenades doesnt change target. I mean it goes in aim direction, doesnt goes higher or fall.

Second:
- Make HE grenade explode (normal explosion) 1 second after touch something (players or walls) and also make it glowing red when is on air (till the explosion)

Third:
- Making Flashbang do damage defined with cvar/define

hornet 09-14-2013 00:52

Re: Grenades...
 
1) Change it's velocity and remove it's gravity.

2) Register touch, use set_rendering(), and then set pev_dmgtime to 0.0 or use CGrenade::Detonate3() with Orpheu.

3) Register ScreenFade message.

pokemonmaster 09-14-2013 03:09

Re: Grenades...
 
i did some tests on this and ended up with having this
PHP Code:

#include <amxmodx>
#include <csx>
#include <engine>
#include <fakemeta>

public plugin_init()
{
    
register_touch("*""grenade""fw_GrenadeTouch")
}

public 
grenade_throw(idiEntwId)
{
    if(
wId != CSW_HEGRENADE)
    {
        return;
    }
    
    new 
Float:flNewVelocity[3]
    
velocity_by_aim(id500flNewVelocity)
    
entity_set_vector(iEntEV_VEC_velocityflNewVelocity)
    
    
//entity_set_float(iEnt, EV_FL_gravity, 0.0)
    
entity_set_int(iEntEV_INT_movetypeMOVETYPE_FLY)
    
    
// Working but not as it should be ..
    //new Float:flVelocity[3]
    //entity_get_vector(iEnt, EV_VEC_velocity, flVelocity)
    //flVelocity[2] = 0.0
    //entity_set_vector(iEnt, EV_VEC_velocity, flVelocity)
    
    
    
entity_set_float(iEntEV_FL_dmgtime9999.0)
    
    
set_rendering(iEntkRenderFxGlowShell25500kRenderNormal16)
}

public 
fw_GrenadeTouch(iTouchedEntiGrenade)
{
    if(!
IsGrenade(iGrenade))
    {
        return;
    }

    if( 
entity_get_int(iTouchedEntEV_INT_solid) == SOLID_TRIGGER )
    {
        return;
    }
    
    
set_rendering(iGrenade)
    
entity_set_float(iGrenadeEV_FL_dmgtime1.0)
}

IsGrenadeiEnt // VEN
{
    if (
get_pdata_int(iEnt114) & (1<<0))
    {
        return 
1
    
}
    
    return 
0




All times are GMT -4. The time now is 18:46.

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