| GhostMan |
08-25-2013 15:47 |
Sound effect only for 1 player
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(id, szName, charsmax(szName)) set_hudmessage(0, 170, 255, 0.04, 0.61, 1, 0.0, 5.0, 0.1, 0.1, 4) ShowSyncHudMsg(0, g_HudSync, "%s connected!", szName) emit_sound(0, CHAN_AUTO, "nvip/connected.wav", 1.0, ATTN_NORM, 0, PITCH_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(id, menu, item) { if(item == MENU_EXIT || !is_user_alive(id)) { menu_destroy(menu) return PLUGIN_HANDLED } new data[6], iName[64] new access, callback menu_item_getinfo(menu, item, access, data,5, iName, 63, callback) new key = str_to_num(data) switch(key) { case 1: { set_user_health(id, get_user_health(id) + 50) set_user_armor(id, get_user_armor(id) + 100) VipUsed[id] = true client_print_color(id, id, "%s You got ^3+50 HP ^1and ^3+100 Armor^1!", PREFIX) emit_sound(id, CHAN_AUTO, "nvip/give_item.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) } case 2: { new p_randomnum = random_num(0, 255) set_user_rendering(id, kRenderFxGlowShell, p_randomnum, p_randomnum, p_randomnum, kRenderNormal, 25) VipUsed[id] = true client_print_color(id, id, "%s Now you're ^3glowing^1!", PREFIX) emit_sound(id, CHAN_AUTO, "nvip/give_item.wav", 1.0, ATTN_NORM, 0, PITCH_NORM) } // etc.. } menu_destroy(menu) return PLUGIN_HANDLED }
|