Raised This Month: $ Target: $400
 0% 

Problem with the player explode on death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Depresie
Veteran Member
Join Date: Nov 2013
Old 10-04-2015 , 14:03   Re: Problem with the player explode on death
Reply With Quote #1

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
new cvar_explode_knocback


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")    
        
cvar_explode_knocback register_cvar("zombie_explode_knockback""500.0"
   
        
giMaxplayers get_maxplayers()
}

public 
event_DeathMsg()
{
    new 
id read_data(2)
    
    if (!
is_user_connected(id) || !is_user_zombie(id))
    {
        return
    }
    
    static 
Float:origin[3// 
    
pev(idpev_originorigin)
    
    
client_cmd(0"spk %s"SOUND2)

    
create_blast(origin)
     
    static 
victim
    victim 
= -1
     
    
while ((victim engfunc(EngFunc_FindEntityInSpherevictimoriginget_pcvar_float(cvar_radius))) != 0)
    {
        
// Only effect alive humans
        
if (!is_user_alive(victim) || is_user_zombie(victim))
            continue;
 
        static 
Float:orig[3], Float:knockback[3]
        
pev(victimpev_originorig)
        
knockback[0] = get_pcvar_float(cvar_explode_knockback) - get_distance_f(originorig) * 0.5
        knockback
[1] = get_pcvar_float(cvar_explode_knockback) - get_distance_f(originorig) * 0.5
        knockback
[2] = get_pcvar_float(cvar_explode_knockback) - get_distance_f(originorig) * 0.5
         
        set_pev
(victimpev_velocityknockback)
        
    }
}


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 Depresie; 10-04-2015 at 14:21.
Depresie 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 22:09.


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