Raised This Month: $12 Target: $400
 3% 

[TUT] Replace Weapon Firing Sounds


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 08-23-2017 , 18:36   Re: [TUT] Replace Weapon Firing Sounds
Reply With Quote #29

Here is an example, needs some conditions to avoid problems, but is the base:

Code:
public fw_UpdateClientData_Post(id, sendweapons, cd_handle) {     // Block default sounds and animation of a weapon     set_cd(cd_handle, CD_flNextAttack, get_gametime() + 0.001) } public fw_PlaybackEvent(flags, invoker, eventid, Float:delay, Float:origin[3], Float:angles[3], Float:fparam1, Float:fparam2, iParam1, iParam2, bParam1, bParam2) {     if (((1<<eventid) != g_iEventId))         return FMRES_IGNORED;     if (!(1 <= invoker <= g_MaxPlayers))         return FMRES_IGNORED;     // PlaybackEvent (play custom sounds to all clients, don't only the owner)     playback_event(flags | FEV_HOSTONLY, invoker, eventid, delay, origin, angles, fparam1, fparam2, iParam1, iParam2, bParam1, bParam2);     return FMRES_SUPERCEDE; } public fw_PrecacheEvent_Post(type, const name[]) {     if (!equal("events/weapon_event.sc", name))         return;     // Precache gun event     g_iEventId |= (1<<get_orig_retval()) } public fw_Item_Deploy_Post(entity) {     new id = get_pdata_cbase(entity, 41, 4)     // Play 'draw' animation     Util_PlayWeaponAnim(id, 1)     // Play 'draw' sound     emit_sound(id, "weapons/draw.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) } public fw_Weapon_PrimaryAttack_Post(entity) {     new id = get_pdata_cbase(entity, 41, 4)     // Play 'fire' animation     Util_PlayWeaponAnim(id, 3)     // Play 'fire' sound     emit_sound(id, "weapons/fire.wav", VOL_NORM, ATTN_NORM, 0, PITCH_NORM) } stock Util_PlayWeaponAnim(id, sequence) {     entity_set_int(id, EV_INT_weaponanim, sequence)     message_begin(MSG_ONE_UNRELIABLE, SVC_WEAPONANIM, .player = id)     write_byte(sequence)     write_byte(entity_get_int(id, EV_INT_body))     message_end() }
__________________









Last edited by CrazY.; 08-23-2017 at 18:38.
CrazY. is offline
 


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 13:18.


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