AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   Day/Night Effect V1.3 (https://forums.alliedmods.net/showthread.php?t=143313)

Destro- 11-17-2010 22:42

Day/Night Effect V1.3
 
2 Attachment(s)
--=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

milu 11-17-2010 23:11

Re: Effect Day/Night V1.1
 
Good!

ConnorMcLeod 11-18-2010 02:10

Re: Effect Day/Night V1.1
 
Quote:

Originally Posted by Destro- (Post 1351656)
Warning:
If the sky is invalid they may cause server crash:(.

Then, check if sky is a default sky, or if files exist.

Destro- 11-18-2010 08:59

Re: Effect Day/Night V1.1
 
Quote:

Originally Posted by ConnorMcLeod
Then, check if sky is a default sky, or if files exist.

Thanks
@EDIT
Updated

S34Qu4K3 11-18-2010 10:41

Re: Effect Day/Night V1.2
 
Nice Destro! GJ :P

Destro- 11-18-2010 14:50

Re: Effect Day/Night V1.2
 
There is something to optimize?

Emp` 11-18-2010 22:16

Re: Effect Day/Night V1.2
 
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".

Destro- 11-20-2010 00:02

Re: Effect Day/Night V1.2
 
Quote:

Originally Posted by Emp` (Post 1352174)
I would personally rename the plugin something along the lines of "hourly", "skys" and "lights".

?

pd:
Quote:

Originally Posted by Destro- (Post 1351812)
Updated

:|

Leon_12 11-20-2010 05:42

Re: Effect Day/Night V1.3
 
change the version in .sma code because it's 1.1 i see the plugin is 1.3

Destro- 11-20-2010 07:49

Re: Effect Day/Night V1.3
 
In a hurry.:(


All times are GMT -4. The time now is 05:14.

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