Raised This Month: $32 Target: $400
 8% 

emit_sound instead of client_cmd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-14-2018 , 09:39   emit_sound instead of client_cmd
Reply With Quote #1

Hello there,

Im using ultimate_sounds plugin which makes a sound while killing someone
so I have those sounds like

PHP Code:
new stksounds[31][] = 
{
    
"misc/killsounds/3multikill_f"
        
......

and then

PHP Code:
public play_sound(sound)
{
    
//new killer = read_data(1)
    
    
sound -=TASK_SOUND
    
//emit_sound( killer, CHAN_ITEM, stksounds[sound], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
    
client_cmd(0"spk %s"stksounds[sound]); 
    
previous_level 0

as you can see I tried to use emit_sound instead of client_cmd since Im trying to play a sound but depending on the distance, so as close youre standing to that person who kills someone you can hear those sounds and if youre kinda far, you cant.

Ive seen similar plugins and there was something like that code above which is canceled.
How can I fix this?
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
E1_531G
Senior Member
Join Date: Dec 2017
Old 04-14-2018 , 15:37   Re: emit_sound instead of client_cmd
Reply With Quote #2

Notice than on cliend_cmd you send to all (0), and on emit_sound only for killer.
Change killer with 0.
Also, i think CHAN_AUTO should be better here.
__________________
My English is A0
E1_531G is offline
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-14-2018 , 15:55   Re: emit_sound instead of client_cmd
Reply With Quote #3

Tried both, didnt work, couldnt hear any sound.
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-14-2018 , 16:51   Re: emit_sound instead of client_cmd
Reply With Quote #4

Quote:
Originally Posted by E1_531G View Post
Notice than on cliend_cmd you send to all (0), and on emit_sound only for killer.
Change killer with 0.
Also, i think CHAN_AUTO should be better here.
You are total ly wrong
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-14-2018 , 17:33   Re: emit_sound instead of client_cmd
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
You are total ly wrong
Since youre good at coding, maybe you got some suggestions
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-14-2018 , 17:38   Re: emit_sound instead of client_cmd
Reply With Quote #6

Quote:
Originally Posted by SomewhereLost View Post
Since youre good at coding, maybe you got some suggestions
Emit_sound its 1st parameter is a valid entity index
To play the sound near that entity.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-14-2018 , 17:40   Re: emit_sound instead of client_cmd
Reply With Quote #7

https://www.amxmodx.org/api/amxmodx/emit_sound

Yeah I got those ones. The code above isnt working.
Theres something wrong in

Quote:
new killer = read_data(1)
and

Quote:
emit_sound( killer, CHAN_ITEM, stksounds[sound], VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
If I dont use read_data for killer, killer should be defined in other way.
__________________

Last edited by SomewhereLost; 04-14-2018 at 17:43.
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
Natsheh
Veteran Member
Join Date: Sep 2012
Old 04-14-2018 , 17:56   Re: emit_sound instead of client_cmd
Reply With Quote #8

You are retrieving the killer id incorrectly.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
SomewhereLost
AlliedModders Donor
Join Date: Mar 2014
Location: Tomorrowland
Old 04-14-2018 , 18:07   Re: emit_sound instead of client_cmd
Reply With Quote #9

Teach me.
__________________
SomewhereLost is offline
Send a message via Skype™ to SomewhereLost
E1_531G
Senior Member
Join Date: Dec 2017
Old 04-15-2018 , 07:41   Re: emit_sound instead of client_cmd
Reply With Quote #10

Quote:
Originally Posted by Natsheh View Post
You are total ly wrong
Quote:
Emit_sound its 1st parameter is a valid entity index
To play the sound near that entity.
You are totally blind: https://www.amxmodx.org/api/amxmodx/emit_sound
Code:
Usage
index	Entity index, use 0 to emit from all clients
All emit = all hear.
__________________
My English is A0

Last edited by E1_531G; 04-15-2018 at 07:42.
E1_531G 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 23:08.


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