Raised This Month: $ Target: $400
 0% 

precache_sound or const


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-19-2010 , 17:36   precache_sound or const
Reply With Quote #1

Which is better?

PHP Code:
new const MENU_POPUP[ ] = "misc/menu_popup.wav" 
PHP Code:
    if ( file_exists"sound/misc/menu_popup.wav" ) )
        
precache_sound"misc/menu_popup.wav" ); 
Debesėlis is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 10-19-2010 , 17:57   Re: precache_sound or const
Reply With Quote #2

If you are using that string in more than 1 place in your code, you should use the constant, because it will only be used once in memory.
Then for file_exists(), you can create a variable to add the sound folder.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-19-2010 , 17:58   Re: precache_sound or const
Reply With Quote #3

Thank you.
Debesėlis is offline
Reply


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 10:21.


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