在CSGO中生成可開啟的武器箱(3個cfg)
使用方法:把3個cfg全放進游戲cfg文件夾里
隨便進入一個地圖
在控制臺逐次輸入
exec case_start?
exec case_knife?
exec case_spawn
以下為3個cfg的內(nèi)容

case_knife.cfg

ent_fire weapon_knife addoutput "classname weapon_knifegg"

case_spawn.cfg

prop_dynamic_create props_foliage/flower_barrel.mdl;
ent_setname case;
ent_fire server command "script SpawnCase()";

case_start.cfg
加粗部分為補充的武器箱

sv_cheats 1;
mp_drop_knife_enable 1;
script function Start(){{if(Entities.FindByName(null,"server")==null){Start1()}}}
script function Start1(){{t<-Entities.CreateByClassname("point_servercommand")}{t.__KeyValueFromString("targetname","server")}{t.__KeyValueFromString("classname","soundent")}}
script Start();
script cases_list<-["armsdeal1.mdl","armsdeal2.mdl","winteroffensive.mdl","armsdeal3.mdl","phoenix.mdl","huntsman.mdl","breakout.mdl","vanguard.mdl","chroma.mdl","chroma2.mdl","bloodhound.mdl","shadow.mdl","revolver.mdl","wildfire.mdl","bravo.mdl","chroma3.mdl","gamma.mdl","gamma2.mdl","glove.mdl","spectrum.mdl","hydra.mdl","spectrum2.mdl","clutch.mdl","horizon.mdl","dangerzone.mdl","community_22.mdl","community_23.mdl","community_24.mdl","community_25.mdl","community_26.mdl","community_27.mdl"];
script c_arr<-{};
script w_arr<-{};
script wi_arr<-{};
script cc<-0;
script weapons_list<-{};
script weapons_list[0]<-["weapon_ak47","rif_ak47"];
script weapons_list[1]<-["weapon_aug","rif_aug"];
script weapons_list[2]<-["weapon_awp","snip_awp"];
script weapons_list[3]<-["weapon_bizon","smg_bizon"];
script weapons_list[4]<-["weapon_cz75a","pist_cz_75"];
script weapons_list[5]<-["weapon_deagle","pist_deagle"];
script weapons_list[6]<-["weapon_famas","rif_famas"];
script weapons_list[7]<-["weapon_fiveseven","pist_fiveseven"];
script weapons_list[8]<-["weapon_g3sg1","snip_g3sg1"];
script weapons_list[9]<-["weapon_galilar","rif_galilar"];
script weapons_list[10]<-["weapon_glock","pist_glock18"];
script weapons_list[11]<-["weapon_hkp2000","pist_hkp2000"];
script weapons_list[12]<-["weapon_knife","knife_default_ct"];
script weapons_list[13]<-["weapon_m249","mach_m249"];
script weapons_list[14]<-["weapon_m4a1","rif_m4a1"];
script weapons_list[15]<-["weapon_m4a1_silencer","rif_m4a1_s"];
script weapons_list[16]<-["weapon_mac10","smg_mac10"];
script weapons_list[17]<-["weapon_mag7","shot_mag7"];
script weapons_list[18]<-["weapon_mp7","smg_mp7"];
script weapons_list[19]<-["weapon_mp5sd","smg_mp5sd"];
script weapons_list[20]<-["weapon_mp9","smg_mp9"];
script weapons_list[21]<-["weapon_negev","mach_negev"];
script weapons_list[22]<-["weapon_nova","shot_nova"];
script weapons_list[23]<-["weapon_p250","pist_p250"];
script weapons_list[24]<-["weapon_p90","smg_p90"];
script weapons_list[25]<-["weapon_revolver","pist_revolver"];
script weapons_list[26]<-["weapon_sawedoff","shot_sawedoff"];
script weapons_list[27]<-["weapon_scar20","snip_scar20"];
script weapons_list[28]<-["weapon_sg556","rif_sg556"];
script weapons_list[29]<-["weapon_tec9","pist_tec9"];
script weapons_list[30]<-["weapon_ump45","smg_ump45"];
script weapons_list[31]<-["weapon_usp_silencer","pist_223"];
script weapons_list[32]<-["weapon_xm1014","shot_xm1014"];
script weapons_list[33]<-["weapon_ssg08 ","snip_ssg08"];
script weapons_list[34]<-["weapon_knife_push","knife_push"];
script weapons_list[35]<-["weapon_elite","pist_elite"];
script weapons_list[36]<-["weapon_knife_survival_bowie","knife_survival_bowie"];
script weapons_list[37]<-["weapon_knife_falchion","knife_falchion_advanced"];
script weapons_list[38]<-["weapon_knife_tactical","knife_tactical"];
script weapons_list[39]<-["weapon_knife_butterfly","knife_butterfly"];
script weapons_list[40]<-["weapon_knife_karambit","knife_karam"];
script weapons_list[41]<-["weapon_knife_m9_bayonet","knife_bayonet"];
script weapons_list[42]<-["weapon_knife_gut","knife_gut"];
script weapons_list[43]<-["weapon_knife_flip","knife_flip"];
script weapons_list[44]<-["weapon_knife_t","knife_tactical"];
script weapons_list[45]<-["weapon_bayonet","knife_bayonet"];
script weapons_list[46]<-["weapon_knife_ct","knife_default_ct"];
script weapons_list[47]<-["weapon_knife_widowmaker","knife_widowmaker"];
script weapons_list[48]<-["weapon_knife_gypsy_jackknife","knife_gypsy_jackknife"];
script weapons_list[49]<-["weapon_knife_stiletto","knife_stiletto"];
script weapons_list[50]<-["weapon_knife_ursus","knife_ursus"];
script weapons_list[51]<-["weapon_knife_css","knife_css"];
script weapons_list[52]<-["weapon_knife_cord","knife_cord"];
script weapons_list[53]<-["weapon_knife_canis","knife_canis"];
script weapons_list[54]<-["weapon_knife_outdoor","knife_outdoor"];
script weapons_list[55]<-["weapon_knife_skeleton","knife_skeleton"];
script function SpawnCase(cas=null){{cc++}{c_arr[cc]<-Entities.FindByName(null,"case")}{cas=CreateProp("prop_dynamic",c_arr[cc].GetOrigin(),("models/props/crates/csgo_drop_crate_"+cases_list[RandomInt(0,cases_list.len()-1)]),0)}{cas.__KeyValueFromString("targetname",""+cc)}{SpawnCaseNext1(c_arr[cc])}{SpawnCaseNext()}}
script function SpawnCaseNext(){{EntFire(""+cc,"setanimationnoreset","fall")}{EntFire(""+cc,"addoutput","OnTakeDamage "+cc+":setanimationnoreset:open:0:1")}{EntFire(""+cc,"addoutput","OnTakeDamage server:Command:script OpenCase("+cc+"):2:1")}{c_arr[cc].EmitSound("UI.StickerDisplay")}}
script function SpawnCaseNext1(cas){{cas.__KeyValueFromString("targetname",""+cc)}{EntFireByHandle(cas,"disabledraw","",0,null,null)}}
script function OpenCase(number){{wi_arr[number]<-RandomInt(0,weapons_list.len()-1)}{w_arr[number]<-Entities.CreateByClassname("prop_physics")}{w_arr[number].SetModel("models/weapons/w_"+weapons_list[wi_arr[number]][1]+"_dropped.mdl")}{w_arr[number].SetOrigin(c_arr[number].GetOrigin())}{w_arr[number].SetOrigin(Vector(w_arr[number].GetOrigin().x,w_arr[number].GetOrigin().y,w_arr[number].GetOrigin().z+35))}{OpenCaseNext(number)}};
script function OpenCaseNext(number){{w_arr[number].__KeyValueFromInt("solid",6)}{w_arr[number].__KeyValueFromInt("minhealthdmg",0)}{w_arr[number].__KeyValueFromString("targetname","w_"+number)}{w_arr[number].__KeyValueFromInt("spawnflags",265)}{EntFire(number,"addoutput","OnTakeDamage w_"+number+":kill::0:1")}{c_arr[number].EmitSound("UI.CrateOpen")}{OpenCaseNextA(number)}}
script function OpenCaseNextA(number){{EntFire(number,"addoutput","OnTakeDamage "+number+":setanimationnoreset:idle::1")}{EntFire(number,"addoutput","OnTakeDamage "+number+":kill:2:1")}{GiveWeapon(weapons_list[wi_arr[number]][0],number)}{EntFire(number,"addoutput","OnTakeDamage server:Command:exec case_knife:1:1")}}
script function GiveWeapon(n,num){{gpe<-null}{gpe<-Entities.CreateByClassname("game_player_equip")}{gpe.__KeyValueFromInt("spawnflags",5)}{gpe.__KeyValueFromInt(n,1)}{gpe.__KeyValueFromString("targetname","gpe_"+num)}{EntFire(num,"addoutput","OnTakeDamage gpe_"+num+":Use::0:1")}{EntFire(num,"addoutput","OnTakeDamage gpe_"+num+":Kill::0.1:1")}}
