Raised This Month: $100 Target: $400
 25% 

Day/Night Effect V1.3


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Counter-Strike        Category:   Fun Stuff        Approver:   Emp` (115)
Destro-
Veteran Member
Join Date: Jun 2010
Location: echo $me->location();
Old 11-17-2010 , 23:42   Day/Night Effect V1.3
Reply With Quote #1

--=Day/Night Effect 1.3=--

Discripcion:
Change the light and sky of map,according to the time.

Credits:
Gladius Idea

Changelogs:
1.1:Add Lights
1.2: Existent file check
1.3: Optimization,Dynamic configuration

Cvars:
amx_dn_sky_on // on/off changing sky
amx_dn_lights_on // on/off light change

sky register:
Create a file ". Ini." skys the name.

Code:
;sky.ini
[sky 1]
hour:0,5
sky_name:space
lights_level:b
 
[sky 2]
hour:6,8
sky_name:space
lights_level:c
 
[sky 3]
hour:9,10
sky_name:space
lights_level:d
 
[sky 4]
hour:11,17
sky_name:des
lights_level:off
 
[sky 5]
hour:18,20
sky_name:des
lights_level:d
 
[sky 6]
hour:21,23
sky_name:space
lights_level:c

Sorry for my English, I use translator.
Someone would be so kind as to correct the translation.
Thanks
Attached Files
File Type: sma Get Plugin or Get Source (day_night.sma - 13102 views - 3.0 KB)
File Type: ini skys.ini (319 Bytes, 7503 views)
__________________

Last edited by Destro-; 02-09-2011 at 10:49. Reason: rename
Destro- is offline
milu
New Member
Join Date: Jul 2010
Old 11-18-2010 , 00:11   Re: Effect Day/Night V1.1
Reply With Quote #2

Good!
milu is offline
Send a message via MSN to milu
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-18-2010 , 03:10   Re: Effect Day/Night V1.1
Reply With Quote #3

Quote:
Originally Posted by Destro- View Post
Warning:
If the sky is invalid they may cause server crash.
Then, check if sky is a default sky, or if files exist.
__________________
- tired and retired -
ConnorMcLeod is offline
Destro-
Veteran Member
Join Date: Jun 2010
Location: echo $me->location();
Old 11-18-2010 , 09:59   Re: Effect Day/Night V1.1
Reply With Quote #4

Quote:
Originally Posted by ConnorMcLeod
Then, check if sky is a default sky, or if files exist.
Thanks
@EDIT
Updated
__________________

Last edited by Destro-; 11-18-2010 at 13:05.
Destro- is offline
S34Qu4K3
Veteran Member
Join Date: Jan 2010
Location: Galicia
Old 11-18-2010 , 11:41   Re: Effect Day/Night V1.2
Reply With Quote #5

Nice Destro! GJ
__________________

- ASM2SMA: Experimental AMXX Assembly encoder

- Defuse Bar Fix

Quote:
Originally Posted by Arkshine
I DON'T WANT TO SEE NOOOOOOOOOOOOOOO AHHHHH. MY EYES ARE ALREADY HURT.
S34Qu4K3 is offline
Destro-
Veteran Member
Join Date: Jun 2010
Location: echo $me->location();
Old 11-18-2010 , 15:50   Re: Effect Day/Night V1.2
Reply With Quote #6

There is something to optimize?
__________________
Destro- is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-18-2010 , 23:16   Re: Effect Day/Night V1.2
Reply With Quote #7

Code:
			num_str_sky = "1"
			g_lights_level = "a"
This is a poor way to copy a string. Please use the copy native.

Code:
		case 0..4: {
			num_str_sky = "1"
			g_lights_level = "a"
		}
//....
		case 23: {
			num_str_sky = "1"
			g_lights_level = "a"
		}
This can be shortened to:
Code:
		case 0..4,23: {
			num_str_sky = "1"
			g_lights_level = "a"
		}
Instead of doing this:
Code:
				g_skyname[0] = ' '
				g_skyname[1] = ' '
				trim(g_skyname)
Look into: String Slicing.

The function set_effect does not need to be public.

Should use log_amx instead of log_to_file.

Instead of using a variable sky_load on line 122, you could simply check if g_skyname is empty or not.

You could also attempt to move the functions load_sky and set_effect into plugin_precache, assuming that you can alter sv_skyname and use set_lights during that time, instead of during plugin_init.

You use charsmax in several spots, would be better if you used it throughout the plugin.

Also work on your whitespace. People prefer lines like this:
Code:
if(!file_exists(file)){
to look like this:
Code:
if ( !file_exists( file ) )
{
Though that is stylistic.

Suggestions:
Have the plugin check every hour for what sky should be present. (Some servers remain on a map for longer than an hour)
Allow the skys.ini to specify a sky for certain hours, and not your 1 to 6 method.
Also allow skys.ini to specify a light level for the matching sky.
I would personally rename the plugin something along the lines of "hourly", "skys" and "lights".

Last edited by Emp`; 11-18-2010 at 23:19.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Old 11-19-2010, 17:14
Destro-
This message has been deleted by Destro-.
Destro-
Veteran Member
Join Date: Jun 2010
Location: echo $me->location();
Old 11-20-2010 , 01:02   Re: Effect Day/Night V1.2
Reply With Quote #8

Quote:
Originally Posted by Emp` View Post
I would personally rename the plugin something along the lines of "hourly", "skys" and "lights".
?

pd:
Quote:
Originally Posted by Destro- View Post
Updated
__________________
Destro- is offline
Leon_12
Senior Member
Join Date: Jul 2010
Location: Bulgaria
Old 11-20-2010 , 06:42   Re: Effect Day/Night V1.3
Reply With Quote #9

change the version in .sma code because it's 1.1 i see the plugin is 1.3
Leon_12 is offline
Send a message via Skype™ to Leon_12
Destro-
Veteran Member
Join Date: Jun 2010
Location: echo $me->location();
Old 11-20-2010 , 08:49   Re: Effect Day/Night V1.3
Reply With Quote #10

In a hurry.
__________________
Destro- 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 11:47.


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