AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Sound help (https://forums.alliedmods.net/showthread.php?t=203886)

MercedeSx7 12-24-2012 12:16

Sound help
 
Hi!
I have a problem with my jetpack + bazooka.
While i'm flying and shoot a missle i cant hear the rocket fire & explode sound.

Action fly user jetpack:
PHP Code:

public action_fly_user_jetpack(id)
{
    new 
Float:velocity[3]
    
velocity_by_aim(id,get_pcvar_num(cvar_aimvelocity),velocity)
    
velocity[2] += float(get_pcvar_num(cvar_zvelocity))
    
entity_set_vector(id,EV_VEC_velocity,velocity)
    
    
energy[id] -= get_pcvar_num(cvar_remove_energy)
    if(
energy[id] < 1energy[id] = 0
    
    set_hudmessage
(25500, -1.00.2906.01.00.10.2, -1)
    
ShowSyncHudMsg(id,hudsync,"Jetpack Energy: [%i / %i]",energy[id],get_pcvar_num(cvar_start_energy))
    
    
emit_sound(id,CHAN_AUTO,"HalloWeeN_TowN/jetpack.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM)
    
    
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
    
write_byte(TE_KILLBEAM)
    
write_short(id)
    
message_end()
    
    if(
entity_get_int(id,EV_INT_flags) & FL_INWATER) return


Action shoot(with bazooka)

PHP Code:

public action_shoot_user_jetpack(id)
{
    
can_shoot[id] = false
    
    emit_sound
(id,CHAN_AUTO,"weapons/rocketfire1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM)
    
    new 
ent create_entity("info_target")
    if(
ent)
    {
        new 
Float:origin[3],Float:velocity[3],Float:angles[3]
        
        
entity_get_vector(id,EV_VEC_origin,origin)
        
velocity_by_aim(id,60,velocity)
        
        
origin[0] += velocity[0]
        
origin[1] += velocity[1]
        
        
velocity[0] = 0.0
        velocity
[1] = 0.0
        
        velocity_by_aim
(id,get_pcvar_num(cvar_speed),velocity)
        
        
entity_set_string(ent,EV_SZ_classname,"info_jetpack_rocket")
        
entity_set_model(ent,"models/rpgrocket.mdl")
        
        
entity_set_int(ent,EV_INT_solid,SOLID_BBOX)
        
entity_set_int(ent,EV_INT_movetype,MOVETYPE_FLY)
        
        
entity_set_size(ent,Float:{-0.5,-0.5,-0.5},Float:{0.5,0.5,0.5})
        
        
entity_set_vector(ent,EV_VEC_velocity,velocity)
        
        
vector_to_angle(velocity,angles)
        
entity_set_vector(ent,EV_VEC_angles,angles)
        
        
entity_set_edict(ent,EV_ENT_owner,id)
        
        
entity_set_int(ent,EV_INT_effects,entity_get_int(ent,EV_INT_effects) | EF_LIGHT)
        
        
entity_set_origin(ent,origin)
        
        
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
        
write_byte(TE_BEAMFOLLOW)
        
write_short(ent)
        
write_short(sprite_beamcylinder)
        
write_byte(30)
        
write_byte(5)
        
write_byte(255)
        
write_byte(255)
        
write_byte(255)
        
write_byte(140)
        
message_end()
    }
    
    
set_task(get_pcvar_float(cvar_reload_time),"action_reload_user_jetpack",id)




All times are GMT -4. The time now is 13:32.

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