Traitoritem is missing

Hey there.
I finished th work on a Traitoritem. I wanted to test it and put the File into the Servers addonfile. My Problem: The Script is missing in the Traitorshop. But the Console doesn’t show up any issues. What did I wrong. It’s my first Lua Script.

Post your code.

I’ll do it when I am back home

Here is the code. This is my first Script. I don´t know if there are any other mistakes. I hope the URL to is ok. I don´t know if there is another way to Post my code.

Is it AddCSLuaFile’d correctly? What does the file structure look like?

This is the file structure:

Shared.lua: Armageddon/gamemodes/terrortown/lua/entities/weapons/shared.lua

The Icon: Armageddon/materials/vgui/TTT/icon_worms.vmt and icon_worms.vtf

The weapon´s Models: Armageddon/models/weapons/TheModels.mdl…and so on

Soundfile: Armageddon/sound/weapons/wormsarmageddon/funkspruch.wav

info.text: Armageddon/info.txt

The cl_init.lua and the init.lua don´t exists because I am using “If SERVER then” and “If CLIENT” then within the shared.lua

Do AddCSLuaFile() instead of AddCSLuaFile(“shared.lua”)

I changed it, but the Traitoritem is still missing.

Is ‘Armageddon’ the root Garry’s Mod directory, or is it an addon folder?

So, you put ‘shared.lua’ in the ‘weapons’ folder? Try renaming it, see how TTT does it:

‘Armageddon’ is the addon´s folder. In it there are all other subfolders and the info.txt.


Try changing your path to look something like that

I´ve got an error in the Server´s Console:

[ERROR] addons/armageddon/gamemodes/terrortown/entities/weapons/weapon_ttt_armageddon/shared.lua:157: attempt to index global ‘self’ (a nil value)

  1. unknown - addons/armageddon/gamemodes/terrortown/entities/weapons/weapon_ttt_armageddon/shared.lua:157

This at the end:

if SERVER then
DamageLog("ARMAGEDDON: " .. self.Owner:Nick() .. " [" .. self.Owner:GetRoleString() .. "] called an Armageddon" )

is causing that error. self is nil and even if it weren’t, this would only be called once when the script is first loaded. Try putting it in the PrimaryAttack function when the armageddon is called.

Thanks. I saw it when I saw shared.lua:157. I will test it and will be back later then.

Well… I get Errrors again:

addons/(ttt) armageddon/gamemodes/terrortown/entities/weapons/weapon_ttt_armageddon/shared.lua:118: attempt to index a nil value

  1. oldprimary - addons/(ttt) armageddon/gamemodes/terrortown/entities/weapons/weapon_ttt_armageddon/shared.lua:118
  2. unknown - lua/damagelogs/sv_damageinfos.lua:54

These is the updated Script:

[editline]22nd January 2017[/editline]

When you equip the Armageddon, you get errors, created by the HUD (default):

[ERROR] gamemodes/terrortown/gamemode/cl_wepswitch.lua:167: attempt to compare string with number

  1. unknown - gamemodes/terrortown/gamemode/cl_wepswitch.lua:167
  2. sort - [C]:-1
    3. UpdateWeaponCache - gamemodes/terrortown/gamemode/cl_wepswitch.lua:186
    4. Enable - gamemodes/terrortown/gamemode/cl_wepswitch.lua:264
    5. SelectNext - gamemodes/terrortown/gamemode/cl_wepswitch.lua:197
    6. unknown - gamemodes/terrortown/gamemode/cl_keys.lua:22