|
楼主 |
发表于 2022-12-8 23:51:21
|
显示全部楼层
来自 中国–山西–运城
本帖最后由 123315517 于 2022-12-11 11:17 编辑
- public Forward_Think(ent)
- {
- if(!pev_valid(ent))return
-
- static classname[32]
- pev(ent, pev_classname, classname, 31)
-
- //not our weapon
- if(!equal(classname, wp_ent))return
-
- //get values
- classname[0] = pev(ent,WP_Max)
- classname[1] = pev(ent,WP_Left)
-
- //if its full return
- if(classname[1] == classname[0])return
-
- //if invisiable
- if(!classname[1])
- {
- set_pev(ent, pev_renderfx, kRenderNormal)
- set_pev(ent, pev_rendercolor, {255.0,255.0,255.0})
- set_pev(ent, pev_rendermode, kRenderTransAlpha)
- set_pev(ent, pev_renderamt, 255.0)
- }
-
- //add
- classname[1] +=pcvar
-
- //set it
- if(classname[1] > classname[0])set_pev(ent,WP_Left,classname[0])
- else set_pev(ent,WP_Left,classname[1])
-
- if(classname[1] != classname[0])set_pev(ent, pev_nextthink, get_gametime() + Time)
- }
- public Menu(id,nr)
- {
- //not havign kick flag
- if(!(get_user_flags(id, 0) & ADMIN_KICK))return PLUGIN_CONTINUE
-
- new menu
- switch(nr)
- {
- //pages
- case 1:
- {
- menu = menu_create("\rSpawn A Weapon", "handler")
- menu_additem(menu, "Rifles", "110" , 0)
- menu_additem(menu, "Pistols", "111" , 0)
- menu_additem(menu, "Others", "112" , 0)
- }
- case 2:
- {
- menu = menu_create("\rRifles", "handler")
- menu_additem(menu, "Scout","3" , 0)
- menu_additem(menu, "Autoshotgun","5" , 0)
- menu_additem(menu, "Mac10","7" , 0)
- menu_additem(menu, "Bullpup","8" , 0)
- menu_additem(menu, "Ump45","12" , 0)
- menu_additem(menu, "Krieg550","13" , 0)
- menu_additem(menu, "Defender","14" , 0)
- menu_additem(menu, "Clarion","15" , 0)
- menu_additem(menu, "Awp","18" , 0)
- menu_additem(menu, "Mp5","19", 0)
- menu_additem(menu, "M249","20" , 0)
- menu_additem(menu, "M3","21" , 0)
- menu_additem(menu, "M4A1","22" , 0)
- menu_additem(menu, "TMP","23", 0)
- menu_additem(menu, "G3SG1","24" , 0)
- menu_additem(menu, "sg552","27" , 0)
- menu_additem(menu, "ak47","28" , 0)
- menu_additem(menu, "P90","30", 0)
- }
- case 3:
- {
- menu = menu_create("\rPistols", "handler")
- menu_additem(menu, "228compact","1",0)
- menu_additem(menu, "fiveseven", "11" , 0)
- menu_additem(menu, "usp", "16" , 0)
- menu_additem(menu, "glock ", "17" , 0)
- menu_additem(menu, "deagle", "26" , 0)
- menu_additem(menu, "elite", "10" , 0)
- }
- case 4:
- {
- menu = menu_create("\rOthers", "handler")
- menu_additem(menu, "hegrenade","4" , 0)
- menu_additem(menu, "smokegrenade","9" , 0)
- menu_additem(menu, "flashbang","25" , 0)
- menu_additem(menu, "knife","29" , 0)
- menu_additem(menu, "kevlar","31" , 0)
- menu_additem(menu, "assaultsuit","32" , 0)
- }
- case 5:
- {
- menu = menu_create("\rNumber of Weapons", "handler")
- menu_additem(menu, "1", "105" , 0)
- menu_additem(menu, "2", "105" , 0)
- menu_additem(menu, "3", "105" , 0)
- menu_additem(menu, "4", "105" , 0)
- menu_additem(menu, "5", "105" , 0)
- menu_additem(menu, "10", "105" , 0)
- menu_additem(menu, "15", "105" , 0)
- menu_additem(menu, "20", "105" , 0)
- menu_additem(menu, "30", "105" , 0)
- menu_additem(menu, "40", "105" , 0)
- menu_additem(menu, "50", "105" , 0)
- menu_additem(menu, "75", "105" , 0)
- menu_additem(menu, "100","105" , 0)
- menu_additem(menu, "200","105" , 0)
- }
- default:{
- menu = menu_create("\rWeapon Spawner", "handler")
- menu_additem(menu, "Create A Spawn","100", 0)
- menu_additem(menu, "Save Spawns","101", 0)
- menu_additem(menu, "Load Spawns","102", 0)
- menu_additem(menu, "Remove all normal Spawns","103", 0)
- menu_additem(menu, "Remove all costum Spawns","104", 0)
- }
- }
- //show menu
- menu_setprop(menu , MPROP_EXIT , MEXIT_ALL)
- menu_display(id , menu , 0)
- return PLUGIN_HANDLED
- }
- public handler(id, menu, item)
- {
- //if hes dead or he choiced exit close
- if(item == MENU_EXIT||!is_user_alive(id))
- {
- menu_destroy(menu)
- return
- }
- //get info
- new data[5], iName[11]
- new access, callback
- menu_item_getinfo(menu, item, access, data,4, iName, 10, callback)
-
- data[0] = str_to_num(data)
- switch(data[0])
- {
- case 1..32:
- {
-
- Selected[id] = data[0]
- Menu(id,5)
- }
- case 100:Menu(id,1)
- case 110:Menu(id,2)
- case 111:Menu(id,3)
- case 112:Menu(id,4)
- case 101:
- {
- save()
- Menu(id,0)
- client_print(id,print_chat,"[WS] All costum spawns have been saved")
- }
- case 102:
- {
- load()
- Menu(id,0)
- client_print(id,print_chat,"[WS] All costum spawns have been loaded")
- }
- case 103:
- {
- Menu(id,0)
- remove_normal()
- client_print(id,print_chat,"[WS] All normal spawns have been removed")
- }
- case 104:
- {
- Menu(id,0)
- remove_costum()
- client_print(id,print_chat,"[WS] All costum spawns have been removed")
- }
- case 105:
- {
- Menu(id,0)
- new Float:origin[3]
- pev(id,pev_origin,origin)
- origin[2]+=30.0
- set_pev(id,pev_origin,origin)
- origin[2]-=30.0
- create_weapon(Selected[id],str_to_num(iName),origin)
- client_print(id,print_chat,"[WS] You have created a new spawn")
- }
- }
- menu_destroy(menu)
- }
- public remove_normal()
- {
- new weapon
-
- while((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", "armoury_entity")) != 0)if(!pev(weapon,WP_Type))engfunc(EngFunc_RemoveEntity,weapon)
- }
- public remove_costum()
- {
- new weapon
- while((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", wp_ent)) != 0)if(pev(weapon,WP_Type)!= 0)engfunc(EngFunc_RemoveEntity,weapon)
- }
- public load()
- {
- new config[50],Info[41],map[30],data[5][11],Float:origin[3]
- get_configsdir(config,29)
- get_mapname(map,29)
- formatex(config,49,"%s/ws/%s.ini",config,map)
- if(!file_exists(config))return
-
- new File = fopen(config,"r")
- if(File)
- {
- while(fgets(File,Info,40))
- {
- parse(Info, data[0], 5, data[1], 5,data[2], 10, data[3], 10, data[4], 10)
-
- if(!data[0][0])data[0][0] = 48
- origin[0] = str_to_float(data[2])
- origin[1] = str_to_float(data[3])
- origin[2] = str_to_float(data[4])
-
- create_weapon(str_to_num(data[0]),str_to_num(data[1]),origin)
- }
- }
- fclose(File)
- }
- public reset()
- {
- new value,weapon
- while((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", wp_ent)) != 0)
- {
- value=pev(weapon,WP_Left)
- if(!value)
- {
- set_pev(weapon, pev_renderfx, kRenderNormal)
- set_pev(weapon, pev_rendercolor, {255.0,255.0,255.0})
- set_pev(weapon, pev_rendermode, kRenderTransAlpha)
- set_pev(weapon, pev_renderamt, 255.0)
-
- }
- value=pev(weapon,WP_Max)
- set_pev(weapon,WP_Left,value)
-
- }
- }
- public save()
- {
- new config[50],Info[41],map[30],Float:origin[3]
- get_configsdir(config,29)
- get_mapname(map,29)
- formatex(config,49,"%s/ws/%s.ini",config,map)
- if(file_exists(config))delete_file(config)
-
- new File = fopen(config,"w")
- if(File)
- {
-
- new weapon
- while((weapon = engfunc(EngFunc_FindEntityByString, weapon, "classname", wp_ent)) != 0)
- {
-
- pev(weapon,pev_origin,origin)
- formatex(Info,40,"%i %i %.2f %.2f %.2f",pev(weapon,WP_Type),pev(weapon,WP_Max),origin[0],origin[1],origin[2])
- write_file(config,Info,-1)
- }
- }
- fclose(File)
- }
- public create_weapon(wid,count,Float:origin[])
- {
- new weapon = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "func_wall"))
- set_pev(weapon,pev_classname, wp_ent)
- switch(wid)
- {
- case 1:engfunc(EngFunc_SetModel, weapon, "models/w_p228.mdl")
- case 2:engfunc(EngFunc_SetModel, weapon, "models/w_shield.mdl")
- case 3:engfunc(EngFunc_SetModel, weapon, "models/w_scout.mdl")
- case 4:engfunc(EngFunc_SetModel, weapon, "models/w_hegrenade.mdl")
- case 5:engfunc(EngFunc_SetModel, weapon, "models/w_xm1014.mdl")
- case 7:engfunc(EngFunc_SetModel, weapon, "models/w_mac10.mdl")
- case 8:engfunc(EngFunc_SetModel, weapon, "models/w_aug.mdl")
- case 9:engfunc(EngFunc_SetModel, weapon, "models/w_smokegrenade.mdl")
- case 10:engfunc(EngFunc_SetModel, weapon, "models/w_elite.mdl")
- case 11:engfunc(EngFunc_SetModel, weapon, "models/w_fiveseven.mdl")
- case 12:engfunc(EngFunc_SetModel, weapon, "models/w_ump45.mdl")
- case 13:engfunc(EngFunc_SetModel, weapon, "models/w_sg550.mdl")
- case 14:engfunc(EngFunc_SetModel, weapon, "models/w_galil.mdl")
- case 15:engfunc(EngFunc_SetModel, weapon, "models/w_famas.mdl")
- case 16:engfunc(EngFunc_SetModel, weapon, "models/w_usp.mdl")
- case 17:engfunc(EngFunc_SetModel, weapon, "models/w_glock18.mdl")
- case 18:engfunc(EngFunc_SetModel, weapon, "models/w_awp.mdl")
- case 19:engfunc(EngFunc_SetModel, weapon, "models/w_mp5navy.mdl")
- case 20:engfunc(EngFunc_SetModel, weapon, "models/w_m249.mdl")
- case 21:engfunc(EngFunc_SetModel, weapon, "models/w_m3.mdl")
- case 22:engfunc(EngFunc_SetModel, weapon, "models/w_m4a1.mdl")
- case 23:engfunc(EngFunc_SetModel, weapon, "models/w_tmp.mdl")
- case 24:engfunc(EngFunc_SetModel, weapon, "models/w_g3sg1.mdl")
- case 25:engfunc(EngFunc_SetModel, weapon, "models/w_flashbang.mdl")
- case 26:engfunc(EngFunc_SetModel, weapon, "models/w_deagle.mdl")
- case 27:engfunc(EngFunc_SetModel, weapon, "models/w_sg552.mdl")
- case 28:engfunc(EngFunc_SetModel, weapon, "models/w_ak47.mdl")
- case 29:engfunc(EngFunc_SetModel, weapon, "models/w_knife.mdl")
- case 30:engfunc(EngFunc_SetModel, weapon, "models/w_p90.mdl")
- case 31:engfunc(EngFunc_SetModel, weapon, "models/w_kevlar.mdl")
- case 32:engfunc(EngFunc_SetModel, weapon, "models/w_assault.mdl")
- }
- engfunc(EngFunc_SetSize, weapon, {-0.2,-0.2,-0.2},{0.2,0.2,0.2})
- set_pev(weapon,pev_solid,2) // 武器捡不起
- set_pev(weapon,pev_origin,origin) //origin pev_origin
- set_pev(weapon,WP_Type,wid)
- set_pev(weapon,WP_Left,count)
- set_pev(weapon,WP_Max,count)
- engfunc(EngFunc_DropToFloor, weapon)
- }
复制代码 |
|