Raised This Month: $ Target: $400
 0% 

Some nade questions.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-29-2007 , 14:06   Some nade questions.
Reply With Quote #1

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?
__________________
DO NOT PM me about avp mod.

Last edited by Rolnaaba; 05-29-2007 at 16:07.
Rolnaaba is offline
mateo10
Veteran Member
Join Date: Jan 2006
Old 05-29-2007 , 14:42   Re: Some nade questions.
Reply With Quote #2

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...     } }
mateo10 is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-29-2007 , 14:51   Re: Some nade questions.
Reply With Quote #3

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
__________________
regalis is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 05-29-2007 , 16:14   Re: Some nade questions.
Reply With Quote #4

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?
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 05-29-2007 , 16:36   Re: Some nade questions.
Reply With Quote #5

When I changed pev_dmg the blast radius increased also.
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-29-2007 , 16:55   Re: Some nade questions.
Reply With Quote #6

Quote:
Originally Posted by Rolnaaba View Post
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
Attached Files
File Type: sma Get Plugin or Get Source (new_henade_efx.sma - 563 views - 3.5 KB)
__________________
regalis is offline
pRED*
Join Date: Dec 2006
Old 05-29-2007 , 17:50   Re: Some nade questions.
Reply With Quote #7

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..
pRED* is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-29-2007 , 17:58   Re: Some nade questions.
Reply With Quote #8

Quote:
Originally Posted by Rolnaaba View Post
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.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.

Last edited by v3x; 05-29-2007 at 19:56.
v3x is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 05-29-2007 , 18:59   Re: Some nade questions.
Reply With Quote #9

Quote:
Originally Posted by v3x View Post
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
__________________
regalis is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-29-2007 , 19:58   Re: Some nade questions.
Reply With Quote #10

Quote:
Originally Posted by regalis View Post
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
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x 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 10:40.


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