You would know better than me. Is this good code? I've been going back and forth on a few different methods of using a string pcvar as a toggle for a sound. Having the sound path if its on, or 0 if its going to be off. This is what i have....
Code:
new pm_sound[32]
public plugin_precache()
{
new sound_pcvar = register_cvar("pm_sound", "buttons/blip2.wav")
get_pcvar_string(sound_pcvar, pm_sound, charsmax(pm_sound) )
if(pm_sound[0])
precache_sound(pm_sound)
}
// using the sound....
if(pm_sound[0])
client_cmd(reciever, "speak ^"sound/%s^"", pm_sound)
Torn between that and using a toggle global var. in such a manner....
Code:
(!is_str_num(pm_sound)) ? sound_toggle = 0 : precache_sound(pm_sound)
initializing sound_toggle = 1
or any other ideas.....I'm open to them.
__________________