View Single Post
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 11-18-2010 , 22: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 22: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`