AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   precache_sound or const (https://forums.alliedmods.net/showthread.php?t=141116)

Debesėlis 10-19-2010 17:36

precache_sound or const
 
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" ); 


Exolent[jNr] 10-19-2010 17:57

Re: precache_sound or const
 
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.

Debesėlis 10-19-2010 17:58

Re: precache_sound or const
 
Thank you.


All times are GMT -4. The time now is 10:21.

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