View Single Post
Author Message
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-19-2010 , 05:13   [STOCK] Creating customizable fog
Reply With Quote #1

Here is a stock i made for creating fog ingame without restarting the server or changing the map
Code:
stock msg_create_fog( iRed, iGreen, iBlue, iDensity ) {     // Fog density offsets [Thnx to DA]     new const fog_density[ ] = { 0, 0, 0, 0, 111, 18, 3, 58, 111, 18, 125, 58, 66, 96, 27, 59, 90, 101, 60, 59, 90,             101, 68, 59, 10, 41, 95, 59, 111, 18, 125, 59, 111, 18, 3, 60, 68, 116, 19, 60 }         // Get the amount of density     new dens     dens = ( 4 * iDensity )         // The fog message     message_begin( MSG_BROADCAST, get_user_msgid( "Fog" ), { 0,0,0 }, 0 )     write_byte( iRed ) // Red     write_byte( iGreen ) // Green     write_byte( iBlue ) // Blue     write_byte( fog_density[ dens ] ) // SD     write_byte( fog_density[ dens + 1 ] ) // ED     write_byte( fog_density[ dens + 2 ] ) // D1     write_byte( fog_density[ dens + 3 ] ) // D2     message_end( ) }

Its usage is simple:
For eg if you want red fog then do this:
PHP Code:
msg_create_fog25500
1st argument is the red color content of the fog [Must be a num between 1-255]
2nd argument is the green color content of the fog [Must be a num between 1-255]
3rd argument is the blue color content of the fog [Must be a num between 1-255]
4th argument is the amount of density of the fog [Must be a num between 1-9]

To disable fog you can do this:
PHP Code:
msg_create_fog000
- For creating black fog [Sounds wierd] you can set all colors to 0
- The fog only works if you have set your cs display settings to OpenGL and you should set this cvar gl_fog to 1 in order to see the fog
- You can change the fog color and density in-game [Using cvars] without restarting the map
__________________

My Plugins For ZP

Inactive due to College and Studies

Last edited by abdul-rehman; 07-21-2010 at 11:23.
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman