#include <amxmodx>
#define PLUGIN "SKY DUST MAPS"
#define VERSION "1.1"
#define AUTHOR "MayroN"
new const MAPS_LIST[][] = { "de_dust", "de_dust2", "de_dust2_2x2", "de_dust2002", "css_dust2" };
new const g_Prefix[][] = { "up", "dn", "ft", "bk", "lf", "rt" };
public plugin_precache()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
new map_name[32];
get_mapname(map_name, charsmax(map_name));
for(new i; i < sizeof MAPS_LIST; i++)
{
if(equali(map_name, MAPS_LIST[i]))
{
for(new a = 1; a <= 5; a++)
{
Precache_Sky(fmt("sky_dust%i_", a));
}
set_pcvar_string(get_cvar_pointer("sv_skyname"), fmt("sky_dust%i_", random_num(1, 5)));
break;
}
}
}
stock Precache_Sky(const szSkyName[])
{
static szBuffer[96];
for(new i; i < sizeof g_Prefix; ++i)
{
formatex(szBuffer, charsmax(szBuffer), "gfx/env/%s%s.tga", szSkyName, g_Prefix[i]);
if(!file_exists(szBuffer))
{
set_fail_state(fmt("File ^"%s^" not found", szBuffer));
return;
}
precache_generic(szBuffer);
}
}