AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Some nade questions. (https://forums.alliedmods.net/showthread.php?t=55779)

Rolnaaba 05-29-2007 14:06

Some nade questions.
 
1) What is the blast radius of a Hegrenade?
2) How can I manipulate the Blast Radius?
3) How can I determin if someone was hit by a nade?
4) Can i determin if the c4 was in the blast radius of the nade, and if so, make the c4 explode?

mateo10 05-29-2007 14:42

Re: Some nade questions.
 
3)
Code:
// ... register_event("Damage", "event_damage", "be"); public event_damage(id) {     new attacker = get_user_attacker(id);     new temp;     if(get_user_weapon(attacker, temp, temp) == CSW_HEGRENADE)     {         // Do your stuff here...     } }

regalis 05-29-2007 14:51

Re: Some nade questions.
 
Here you find everything but the c4 thingy..:
http://forums.alliedmods.net/showthread.php?t=54988
Feel free to use what you need! ;)

greetz regalis

Rolnaaba 05-29-2007 16:14

Re: Some nade questions.
 
ok I see how to make a he-explosion radius:
Code:
message_begin(MSG_BROADCAST,SVC_TEMPENTITY); write_byte(TE_EXPLOSION); write_coord(origin[0]); // origin x write_coord(origin[1]); // origin y write_coord(origin[2]); // origin z write_short(sprite index); write_byte(size); write_byte(frame rate); write_byte(flags); message_end();

but what I want to do is catch when a he-gernade explodes, and increase the radius, so i need the defualt radius of an he-gernade. Can someone show me how to catch explosion, and get the origin of it, and tell me defualt blast radius, so i can do a check of everyone in range ofthe New Blast Radius, and do damage to them. Also how can I make the c4 explode.

SO mainly the big questions are:
How can I catch where an he-gernade explodes, and the origin of the explosion.
AND
How cna I make the c4 explode?

P34nut 05-29-2007 16:36

Re: Some nade questions.
 
When I changed pev_dmg the blast radius increased also.

regalis 05-29-2007 16:55

Re: Some nade questions.
 
1 Attachment(s)
Quote:

Originally Posted by Rolnaaba (Post 483433)
ok I see how to make a he-explosion radius:

*sniped code*

but what I want to do is catch when a he-gernade explodes, and increase the radius, so i need the defualt radius of an he-gernade. Can someone show me how to catch explosion, and get the origin of it, and tell me defualt blast radius, so i can do a check of everyone in range ofthe New Blast Radius, and do damage to them. Also how can I make the c4 explode.

SO mainly the big questions are:
How can I catch where an he-gernade explodes, and the origin of the explosion.
AND
How cna I make the c4 explode?

I can't help you with the explosion of the c4..no idea *sorry*
But with the radius damage...
This message code is only the explosion EFFECT! ;)
Look at the function giveDamage()
Code:

//+++++ Explosion damage ++++++
giveDamage(ent)
{
    while(((g_ePlayer = engfunc(EngFunc_FindEntityByString, g_ePlayer, CLASSNAME, PLAYER_CLASS)) != 0) && (pev_valid(ent)))
    {
        // If player is near the CrazyBouncingNade then give damage
        if(ent_distance(ent, g_ePlayer) <= 250.0)
        {
            // Get the current Health from the player
            g_EntityHealth = pev(g_ePlayer, pev_health);
           
            // Calculate the subtracted Health depending on the configuration of the CVAR
            switch(g_dmgt)
            {
                case 1:{g_subHealth = (g_EntityHealth/10);}        // subtract 10% of Players current Health
                case 2:{g_subHealth = (g_EntityHealth/10)*2;}    // subtract 20% of Players current Health
                case 3:{g_subHealth = (g_EntityHealth/10)*3;}    // subtract 30% of Players current Health
                case 4:{g_subHealth = (g_EntityHealth/10)*4;}    // subtract 40% of Players current Health
                case 5:{g_subHealth = (g_EntityHealth/2);}        // subtract 50% of Players current Health
            }
            // Call the Stock to set the players Health
            set_health(g_ePlayer, g_subHealth, "sub");
        }
    }
    // Reset the global Player Variable
    g_ePlayer = -1;
   
    return PLUGIN_CONTINUE;
}

You can change the code that the damage decrease with the distance...
You want to change the standard HE explosion into a BIIIIGG explosion, right?
Look at this plugin from Samuraii16, there you can see how he catches the explosion ;)
The standard radius is afaik 300 units...but im not sure with that.

greetz regalis

pRED* 05-29-2007 17:50

Re: Some nade questions.
 
Use tracehull to see if the c4 is in the blast radius. Avalanche's weapon immunity plugin would be a good place to start looking..

v3x 05-29-2007 17:58

Re: Some nade questions.
 
Quote:

Originally Posted by Rolnaaba (Post 483433)
How can I catch where an he-gernade explodes, and the origin of the explosion.

Here's a way to get the grenade origin and the owner:
Code:

#include <amxmodx>
#include <fakemeta>

public plugin_init()
{
        register_forward(FM_EmitSound, "EmitSound");
}

public EmitSound(entity, channel, const sound[])
{
        if(!pev_valid(entity))
                return FMRES_IGNORED;

        if(!contain(sound, "hegrenade-"))
        {
                new Float:origin[3], owner;
                pev(entity, pev_origin, origin);
                pev(entity, pev_owner, owner);

                client_print(owner, 3, "Grenade origin: %f %f %f", origin[0], origin[1], origin[2]);
        }

        return FMRES_IGNORED;
}

That should work.

regalis 05-29-2007 18:59

Re: Some nade questions.
 
Quote:

Originally Posted by v3x (Post 483480)
Here's a way to get the grenade origin and the owner:
Code:

if(!contain(sound, "grenade_hit"))

the grenade_hit (1|2|3) sounds are emitted when a grenade(flashbang, smokenade) hits the ground..so wouldn't it be better to check if the sound contain hegrenade-1 or hegrenad-2 ?
btw.: !contain <-- is this a typo!?

looks strange..0o

v3x 05-29-2007 19:58

Re: Some nade questions.
 
Quote:

Originally Posted by regalis (Post 483501)
the grenade_hit (1|2|3) sounds are emitted when a grenade(flashbang, smokenade) hits the ground..so wouldn't it be better to check if the sound contain hegrenade-1 or hegrenad-2 ?
btw.: !contain <-- is this a typo!?

looks strange..0o

Updated the code. Thanks!

It returns 0 when a match is found and -1 when one isn't.

People usually do it this way:
Code:

if(contain(string, "findme") != -1)
But both ways do work :)


All times are GMT -4. The time now is 10:40.

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