View Single Post
Author Message
slLent
Member
Join Date: Apr 2010
Location: Tomsk, Russia
Old 04-11-2014 , 07:11   AMXX Module: EmitSound2
Reply With Quote #1

EmitSound2


Description:
The new native emit_sound allowing send message SVC_SOUND for only one client.

Quote:
/*
* id - Player index which play the sound.
* receiver - Player index which receives the sound.
* channel - Channel
* sample - Sample sound
* volume - Volume sound
* attn - Attenuation
* pitch - Pitch sound
* origin - Coordinates play the sound if "id" equal 0 (worldspawn)
*/

native emit_sound2(id,receiver,channel,const sample[],Float:volume,Float:attn,flags,pitch,Float: origin[3] = {0.0,0.0,0.0});
Example:
PHP Code:
#include <amxmodx>

native emit_sound2(id,receiver,channel,const sample[],Float:volume,Float:attn,flags,pitch,Float:origin[3] = {0.0,0.0,0.0});

public 
plugin_init()
{
    
register_clcmd("say /emit2","cmdSound");
}

public 
cmdSound(id)
{
    
emit_sound2(id,id,CHAN_WEAPON,"weapons/ak47-1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);

or for everybody, apart from "id" player

PHP Code:
public cmdSound(id)
{
    for(new 
1<= get_maxplayers(); i++)
    {
        if(!
is_user_connected(i) || == id)
            continue;

        
emit_sound2(id,i,CHAN_WEAPON,"weapons/ak47-1.wav",VOL_NORM,ATTN_NORM,0,PITCH_NORM);
    }



View source file

Attached Files
File Type: zip EmitSound2.zip (20.2 KB, 448 views)

Last edited by slLent; 04-11-2014 at 23:16.
slLent is offline