Garry's Mod

Garry's Mod

Half-Life Co-op: Infected
 此主题已被置顶,因此可能具有重要性
upset  [开发者] 2020 年 11 月 8 日 上午 3:48
Adding custom weapons to Weapon Shop
There is ability for server owners to use custom weapons that players can buy for score.

How to
Create a .lua file with any name (let it be inf_weapons.lua) in garrysmod/lua/autorun and add following code:
local weplist = { ["weapon_class_name"] = {cost = SCORE, name = "Your Weapon Name", ammocost = SCORE_AMMO}, ["weapon_class_name"] = {cost = SCORE, name = "Your Weapon Name", ammocost = SCORE_AMMO}, } hook.Add("HL1_WeaponShop_CustomWeapons", "InfectedWeapons", function() return weplist end)
Replace "weapon_class_name" with your weapon class name, e.g. "weapon_q2_bfg10k"
SCORE is how much score is needed to buy it, e.g. 1500
"Your Weapon Name" is weapon name to show in the shop
SCORE_AMMO is required score for buying ammo, e.g. 100

Example
local weplist = { ["weapon_cs16_deagle"] = {cost = 300, name = "Desert Eagle", ammocost = 50}, ["weapon_q2_bfg10k"] = {cost = 4000, name = "BFG10K", ammocost = 400}, ["weapon_q3_railgun"] = {cost = 3000, name = "Railgun", ammocost = 150}, } hook.Add("HL1_WeaponShop_CustomWeapons", "InfectedWeapons", function() return weplist end)
最后由 upset 编辑于; 2020 年 11 月 10 日 下午 1:32
< >
正在显示第 1 - 6 条,共 6 条留言
Eclipse 2021 年 4 月 1 日 下午 6:48 
is there a way you could do this in console?
upset  [开发者] 2021 年 4 月 1 日 下午 11:51 
nope
will you make a tutorial to make a custom map?
mrkirill405 ✓ 2024 年 12 月 1 日 下午 2:00 
A bug with getting ammo for custom
[Half-Life Co-op: Infected] gamemodes/hl1coop_infected/gamemode/cl_menus.lua:366: attempt to perform arithmetic on field 'MaxAmmo' (a nil value)
1. unknown - gamemodes/hl1coop_infected/gamemode/cl_menus.lua:366 (x102)
Please reply, issue still remains (
=(
< >
正在显示第 1 - 6 条,共 6 条留言
每页显示数: 1530 50