Raised This Month: $ Target: $400
 0% 

Sound effect only for 1 player


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 08-25-2013 , 15:47   Sound effect only for 1 player
Reply With Quote #1

I'm using this code so that connected.wav would play globaly when VIP player connects.
PHP Code:
public client_putinserver(id)
{
    if(
get_user_flags(id) & VIP_ACCESS_NOBUY && g_iRoundCount 1)
    {
        new 
szName[32]
        
get_user_name(idszNamecharsmax(szName))
        
        
set_hudmessage(01702550.040.6110.05.00.10.14)
        
ShowSyncHudMsg(0g_HudSync"%s connected!"szName)
        
        
emit_sound(0CHAN_AUTO"nvip/connected.wav"1.0ATTN_NORM0PITCH_NORM)
    }

Also i use this code (below) to play give_item.wav sound when something from vip menu is selected. However i would like that sound would play only for player who made that selection. How do i do that?

PHP Code:
public VipCTMenu_handler(idmenuitem)
{
    if(
item == MENU_EXIT || !is_user_alive(id))
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
        case 
1:
        {
            
set_user_health(idget_user_health(id) + 50)
            
set_user_armor(idget_user_armor(id) + 100)
            
            
VipUsed[id] = true
            
            client_print_color
(idid"%s You got ^3+50 HP ^1and ^3+100 Armor^1!"PREFIX)
            
emit_sound(idCHAN_AUTO"nvip/give_item.wav"1.0ATTN_NORM0PITCH_NORM)
        }
        case 
2:
        {
            new 
p_randomnum random_num(0255)
            
            
set_user_rendering(idkRenderFxGlowShellp_randomnump_randomnump_randomnumkRenderNormal25)
            
            
VipUsed[id] = true
            
            client_print_color
(idid"%s Now you're ^3glowing^1!"PREFIX)
            
emit_sound(idCHAN_AUTO"nvip/give_item.wav"1.0ATTN_NORM0PITCH_NORM)
        }
        
        
// etc..
    
}
    
    
menu_destroy(menu)
    return 
PLUGIN_HANDLED


Last edited by GhostMan; 08-25-2013 at 15:48.
GhostMan 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 19:13.


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