Raised This Month: $ Target: $400
 0% 

Optomize


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 06-28-2012 , 21:27   Optomize
Reply With Quote #1

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.
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 06-29-2012 at 02:32. Reason: updated to latest optimization
Liverwiz 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 15:03.


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