Raised This Month: $ Target: $400
 0% 

Problem with the player explode on death


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Krtola
Veteran Member
Join Date: Oct 2013
Location: Serbia
Old 10-03-2015 , 08:01   Problem with the player explode on death
Reply With Quote #1

When a zombie dies this plugin creating an explosion that should knock back humans.
The problem is that this sometimes happens(knock back humans), but not often(one in ten attempts approximately)but you should always happen when humans are in explode radius.
Does anyone know what could be the problem?
PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <biohazard>

#define SOUND2 "garg/gar_stomp1.wav"
#define is_player(%0) (1 <= %0 <= giMaxplayers)


new cvar_radiusg_exploSprgiMaxplayers


public plugin_precache( )
{
        
g_exploSpr engfunc(EngFunc_PrecacheModel"sprites/shockwave.spr")

        
precache_sound(SOUND2)
}

public 
plugin_init( )
{
    
register_plugin"Zombie Explode""1.0""Krtola" )

        
register_event"DeathMsg""event_DeathMsg""a" )
    
        
cvar_radius register_cvar("zombie_explode_radius""999.0")        
    
        
giMaxplayers get_maxplayers()
}

public 
event_DeathMsg( )
{
    new 
id read_data)
    
    if( !
is_user_connectedid ) || !is_user_zombieid ) )
        return 
PLUGIN_HANDLED
        
    
static EntFloatoriginF[3]
    
pev(idpev_originoriginF)
        static 
FloatioriginF[3]

        
client_cmd(0"spk %s"SOUND2)

        
create_blast(originF)
    
    while( (
Ent engfunc(EngFunc_FindEntityInSphereEntoriginFget_pcvar_float(cvar_radius))) )
    {
        if(
is_player(Ent) && Ent != id)
        {      
            if(
is_user_zombie(Ent))
                return 
PLUGIN_CONTINUE

            pev
(Entpev_originioriginF)
            
            
originF[0] = (ioriginF[0] - originF[0]) * 10.0 
            originF
[1] = (ioriginF[1] - originF[1]) * 10.0 
            originF
[2] = (ioriginF[2] - originF[2]) + 500.0
            
            set_pev
(Entpev_velocityoriginF)
        }
    }
    
    return 
PLUGIN_HANDLED
}


create_blast(const Float:originF[3])
{
    
// Medium ring
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[2]+199.0// z axis
    
write_short(g_exploSpr// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(6// life
    
write_byte(40// width
    
write_byte(20// noise
    
write_byte(255// red
    
write_byte(0// green
    
write_byte(0// blue
    
write_byte(200// brightness
    
write_byte(0// speed
    
message_end()
    
    
// Largest ring
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_BEAMCYLINDER// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x axis
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y axis
    
engfunc(EngFunc_WriteCoordoriginF[2]+299.0// z axis
    
write_short(g_exploSpr// sprite
    
write_byte(0// startframe
    
write_byte(0// framerate
    
write_byte(6// life
    
write_byte(40// width
    
write_byte(20// noise
    
write_byte(255// red
    
write_byte(0// green
    
write_byte(0// blue
    
write_byte(100// brightness
    
write_byte(0// speed
    
message_end()
    
    
// Luz Dinamica
    
engfunc(EngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF0)
    
write_byte(TE_DLIGHT// TE id
    
engfunc(EngFunc_WriteCoordoriginF[0]) // x
    
engfunc(EngFunc_WriteCoordoriginF[1]) // y
    
engfunc(EngFunc_WriteCoordoriginF[2]) // z
    
write_byte(25// radio
    
write_byte(250// red
    
write_byte(250// green
    
write_byte(250// blue
    
write_byte(50// vida en 0.1, 30 = 3 segundos
    
write_byte(50// velocidad de decaimiento
    
message_end()


Last edited by Krtola; 10-03-2015 at 08:01.
Krtola is offline
Send a message via Skype™ to Krtola
 


Thread Tools
Display Modes

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 22:09.


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