|
发表于 2009-1-9 23:51:13
|
显示全部楼层
|阅读模式
来自 中国–广东–广州–白云区
本帖最后由 点通粉丝 于 2009-1-10 07:34 编辑
- /*
- sv_customsky <0-2>
- 0 : plugin off.
- 1 : change sky based on map (edit custom_sky.cfg). (Default)
- 2 : change sky based on sv_customskyname cvar.
- 3 : change sky based on random sky
- sv_customskyname "test_" - use if sv_customsky is set to 2.
- backalley,badlands,blue,city1,cliff,cx,de_storm,desert,Des,doom1,DrkG,dusk,forest,green,grnplsnt,morningdew,office,snow,tornsky,TrainYard,tsccity_,snowlake_
- #define PLUGIN "custom sky"
- #define VERSION "1.1"
- #define AUTHOR "cheap_suit"
- */
- #include <amxmodx>
- #include <amxmisc>
- #define PLUGIN "SKY"
- #define VERSION "1.0"
- #define AUTHOR "CS-FG"
- #define max_suffix 6
- new g_suffix[max_suffix][3] = { "up", "dn", "ft", "bk", "lf", "rt" }
- new skyarray[22][16]={"backalley","badlands","blue","city1","cliff","cx","de_storm","desert","Des","doom1","DrkG","dusk","forest","green","grnplsnt","morningdew","office","snow","tornsky","TrainYard","tsccity_","snowlake_"}
- public plugin_precache()
- {
- register_plugin(PLUGIN, VERSION, AUTHOR)
- register_cvar(PLUGIN, VERSION, FCVAR_SPONLY|FCVAR_SERVER)
-
- register_cvar("sv_customsky", "3")
- register_cvar("sv_customskyname", "test_")
-
- switch(get_cvar_num("sv_customsky"))
- {
- case 1:
- {
- static configsdir[32]
- get_configsdir(configsdir, 31)
-
- static file[64]
- formatex(file, 63, "%s/custom_sky.cfg", configsdir)
-
- static mapname[32]
- get_mapname(mapname, 31)
-
- if(!file_exists(file))
- {
- write_file(file, "; Custom map sky config")
- write_file(file, "; Format: <mapname> <skyname>")
- }
-
- new line = 0, length = 0
- static text[64], maptext[32], tgatext[32]
- while(read_file(file, line++, text, 127, length))
- {
- if((text[0] == ';') || !length)
- continue
-
- parse(text, maptext, 31, tgatext, 31)
- if(equal(maptext, mapname))
- {
- precache_sky(tgatext)
- break
- }
- }
- }
- case 2:
- {
- static cvar_skyname[32]
- get_cvar_string("sv_customskyname", cvar_skyname, 31)
-
- if(strlen(cvar_skyname) > 0)
- precache_sky(cvar_skyname)
- }
- case 3:
- {
- static random_skyname[32]
- //get_cvar_string("sv_customskyname", random_skyname, 31)
- new randomnum=random_num(0,21)
- random_skyname=skyarray[randomnum]
- if(strlen(random_skyname) > 0)
- precache_sky(random_skyname)
- }
- }
- }
- public precache_sky(const skyname[])
- {
- new bool:found = true
- static tgafile[35]
-
- for(new i = 0; i < max_suffix; ++i)
- {
- formatex(tgafile, 34, "gfx/env/%s%s.tga", skyname, g_suffix[i])
- if(file_exists(tgafile))
- precache_generic(tgafile)
- else
- {
- log_amx("Cannot locate file '%s'", tgafile)
- found = false
- break
- }
- }
-
- if(found)
- set_cvar_string("sv_skyname", skyname)
- }
复制代码 CS1.5随机天空插件源码
在新的一年里.我也发一个好东东比.还在和我一样还完CS1.5的朋友一起用吧
在此感谢飞哥 |
|