Raised This Month: $ Target: $400
 0% 

Solved Problem with env_explosion


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
FrAgOrDiE
AlliedModders Donor
Join Date: May 2018
Location: Italy
Old 02-02-2021 , 06:51   Problem with env_explosion
Reply With Quote #1

Hello, I'm trying to create an explosion effect on an entity after hit, then I kill the entity.
Here's the code, the problem with this is that the shooter can't see the explosion, any other player can.
Why is this happening?
PHP Code:
void SpawnCrate()
{
    ...
    
SDKHook(crateSDKHook_TraceAttackPostSDKCB_Hit);
    ...
}

public 
void SDKCB_Hit(int victimint attackerint inflictorfloat damageint damagetypeint ammotypeint hitboxint hitgroup)
{    
    
float fPos[3];
    
GetEntPropVector(g_CrateProp_Send"m_vecOrigin"fPos);
    
    
CreateExplosion(fPos);
    
AcceptEntityInput(g_Crate"Kill");
    
//CratePickup(attacker);
    
    
g_Crate INVALID_ENT_REFERENCE;
}

void CreateExplosion(float pos[3])
{
    
int explode CreateEntityByName("env_explosion");
    if (
explode == -1)
        return;
    
DispatchKeyValue(explode"iMagnitude""0");
    
DispatchKeyValue(explode"rendermode""5");
    
DispatchKeyValue(explode"classname""weapon_c4");
    
DispatchSpawn(explode);
    
TeleportEntity(explodeposNULL_VECTORNULL_VECTOR);
    
AcceptEntityInput(explode"Explode");

Edit: fixed with tempents.
__________________
Add me on discord: FrAgOrDiE#5182
Add me on steam: https://steamcommunity.com/id/fragordie002/
Join my discord server: http://discord.gg/JpAUXMn

Last edited by FrAgOrDiE; 02-03-2021 at 07:46.
FrAgOrDiE is offline
 



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 15:17.


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