Raised This Month: $ Target: $400
 0% 

Solved Creating a he grenade and detonate it


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Lolz123
Member
Join Date: Aug 2010
Old 05-26-2017 , 03:00   Creating a he grenade and detonate it
Reply With Quote #1

I'm using this code to spawn a grenade.

PHP Code:
int entity CreateEntityByName("hegrenade_projectile");

SetEntProp(entityProp_Data"m_takedamage"2);
SetEntProp(entityProp_Data"m_iMaxHealth"1);
SetEntProp(entityProp_Data"m_iHealth"1);

SetEntPropEnt(entityProp_Send"m_hOwnerEntity"client);
SetEntPropEnt(entityProp_Data"m_hThrower"client);
SetEntProp(entityProp_Data"m_iTeamNum"GetClientTeam(client));
SetEntPropFloat(entityProp_Data"m_flDamage"200.0);
SetEntPropFloat(entityProp_Data"m_DmgRadius"350.0);

SetEntPropFloat(entityProp_Send"m_flElasticity"0.0);

TeleportEntity(entitygrenadelocNULL_VECTORfVelocity); 
DispatchSpawn(entity); 
And I detonate it with
PHP Code:
SDKHooks_TakeDamage(entity001.0); 
The problem is when it hits someone the server crashes, but when it hits no one it explodes normally (like a real grenade).

What did I missed?

Edit:
I fixed it.

For anyone who wants:
PHP Code:
int ent_explosion CreateEntityByName("env_explosion");

SetEntProp(ent_explosionProp_Data"m_iMagnitude"99);
SetEntProp(ent_explosionProp_Data"m_iRadiusOverride"250);
SetEntPropFloat(ent_explosionProp_Data"m_flDamageForce"99.0);

SetEntPropEnt(ent_explosionProp_Data"m_hInflictor"owner);
SetEntPropEnt(ent_explosionProp_Data"m_hOwnerEntity"owner); 

DispatchKeyValue(ent_explosion"rendermode""5");
DispatchKeyValue(ent_explosion"spawnflags""2");
DispatchKeyValue(ent_explosion"classname""weapon_hegrenade");

DispatchSpawn(ent_explosion);

TeleportEntity(ent_explosionfOriginNULL_VECTORNULL_VECTOR);

AcceptEntityInput(ent_explosion"Explode");
AcceptEntityInput(ent_explosion"Kill"); 

Last edited by Lolz123; 05-26-2017 at 11:24.
Lolz123 is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 05-26-2017 , 03:44   Re: Creating a he grenade and detonate it
Reply With Quote #2

I would hook a legit projectile entity being created, wait a frame before printing out the net props u set.
__________________
Neuro Toxin 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 05:55.


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