Raised This Month: $68 Target: $400
 17% 

[STOCK] Creating customizable fog


Post New Thread Reply   
 
Thread Tools Display Modes
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
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 07-19-2010 , 06:02   Re: [STOCK] Creating customizable fog
Reply With Quote #2

You have fps drops when using this? (I get a drop from 101 to 40 when using smoke)
__________________
I am out of order!
grimvh2 is offline
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-20-2010 , 04:05   Re: [STOCK] Creating customizable fog
Reply With Quote #3

Quote:
Originally Posted by grimvh2 View Post
You have fps drops when using this? (I get a drop from 101 to 40 when using smoke)
No.....
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
grimvh2
Veteran Member
Join Date: Nov 2007
Location: Fishdot Nation
Old 07-20-2010 , 08:08   Re: [STOCK] Creating customizable fog
Reply With Quote #4

Quote:
Originally Posted by abdul-rehman View Post
No.....
Then this is helpfull, thanks.
__________________
I am out of order!
grimvh2 is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 07-20-2010 , 14:22   Re: [STOCK] Creating customizable fog
Reply With Quote #5

Change MSG_ALL to MSG_BROADCAST
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-20-2010 , 19:14   Re: [STOCK] Creating customizable fog
Reply With Quote #6

can you add a Screenshot, please?
__________________
Quote:
#define true ((rand() % 2)? true: false) //Happy debugging suckers
mottzi is offline
Send a message via MSN to mottzi
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-21-2010 , 03:45   Re: [STOCK] Creating customizable fog
Reply With Quote #7

Quote:
Originally Posted by joropito View Post
Change MSG_ALL to MSG_BROADCAST
Can u tell me whats the difference between them ?
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 07-21-2010 , 08:41   Re: [STOCK] Creating customizable fog
Reply With Quote #8

Quote:
Originally Posted by abdul-rehman View Post
Can u tell me whats the difference between them ?
MSG_ALL: tries to send a reliable msg to all players and wait for that

MSG_BROADCAST: send a msg and trust that it will be read by each player


Using MSG_ALL you can get some crash with a lagged server or a high cpu usage.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
abdul-rehman
Veteran Member
Join Date: Jan 2010
Location: Khi, Pakistan
Old 07-21-2010 , 11:23   Re: [STOCK] Creating customizable fog
Reply With Quote #9

Quote:
Originally Posted by joropito View Post
MSG_ALL: tries to send a reliable msg to all players and wait for that

MSG_BROADCAST: send a msg and trust that it will be read by each player


Using MSG_ALL you can get some crash with a lagged server or a high cpu usage.
OK thanx for the information
__________________

My Plugins For ZP

Inactive due to College and Studies
abdul-rehman is offline
Send a message via Yahoo to abdul-rehman Send a message via Skype™ to abdul-rehman
DruGzOG
Veteran Member
Join Date: Nov 2007
Location: Unknown
Old 07-23-2010 , 21:41   Re: [STOCK] Creating customizable fog
Reply With Quote #10

How does this not drop fps?
__________________
DruGzOG is offline
Send a message via AIM to DruGzOG
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 15:27.


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