[TTT] Detective/Traitor menu popups but gives lua error and shows no weapons.
7 replies, posted
[LUA]local Equipment = nil
function GetEquipmentForRole(role)
-- need to build equipment cache?
if not Equipment then
-- start with all the non-weapon goodies
local tbl = table.Copy(EquipmentItems)
-- find buyable weapons to load info from
for k, v in pairs(weapons.GetList()) do
if v and v.CanBuy then
local data = v.EquipMenuData or {}
local base = {
id = WEPS.GetClass(v),
name = v.PrintName or "Unnamed",
limited = v.LimitedStock,
kind = v.Kind or WEAPON_NONE,
slot = (v.Slot or 0) + 1,
material = v.Icon or "vgui/ttt/icon_id",
-- the below should be specified in EquipMenuData, in which case
-- these values are overwritten
type = "Type not specified",
model = "models/weapons/w_bugbait.mdl",
desc = "No description specified."
};
-- Force material to nil so that model key is used when we are
-- explicitly told to do so (ie. material is false rather than nil).
if data.modelicon then
base.material = nil
end
table.Merge(base, data)
-- add this buyable weapon to all relevant equipment tables
for _, r in pairs(v.CanBuy) do
table.insert(tbl[r], base)
end
end
end
[/LUA]
PORTION OF CODE ^
[LUA][ERROR] gamemodes/terrortown/gamemode/cl_equip.lua:44: bad argument #1 to 'insert' (table expected, got nil)
1. insert - [C]:-1
2. GetEquipmentForRole - gamemodes/terrortown/gamemode/cl_equip.lua:44
3. unknown - gamemodes/terrortown/gamemode/cl_equip.lua:218
4. unknown - lua/includes/modules/concommand.lua:54[/LUA]
Heres my issue, Upon pressing C as a Traitor i get this error ^ and the T menu popups(but i cannot close it) and the menu has nothing in it. From what I THINK it seems, GetEquipmentForRole isn't defined(or it doesn't know what role i am and doesn't know what to grab). I have little to no experience in LUA and would appreciate some help! For those who are interested in seeing the full code([url]https://raw.githubusercontent.com/garrynewman/garrysmod/master/garrysmod/gamemodes/terrortown/gamemode/cl_equip.lua[/url])
I had posted this in the thread where you post what you need help with but doesn't think it needs a thread but it seems that i was skipped over twice in that thread. I removed my pointshop2,pac,libk,promethus and i still get this error. I had gotten this error after adding those addons but have never gotten it before but yet after removing them i still have issues. Can someone care to chime in and help a fellow who needs it?
Re-install TTT?
Re-installing TTT doesn't work. I still get the error.
[QUOTE=Keosan;48340387]Re-installing TTT doesn't work. I still get the error.[/QUOTE]
Then it must be one of your addons (Check garrysmod/lua as well)
Ill check and see. All i have is ULX and iSpy, and Awarn2
This still comes up. I removed all addons and i still get this issue. I'll try updating to the current TTT update and see if it works but.... i don't have my hopes up
try running a full validation
[QUOTE=whitestar;48514524]try running a full validation[/QUOTE]
I just did a complete wipe, i'll update to the latest TTT and then see what happens. Then i'll slowly add addons one by one
Sorry, you need to Log In to post a reply to this thread.