Grapple Hook getting script errors

Ok so here is the original:

I then added this to it to make it compatible with TTT:


SWEP.Base				= "weapon_tttbase"
SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.Kind = WEAPON_HEAVY

SWEP.AmmoEnt = "item_ammo_smg1_ttt"

SWEP.CanBuy = { ROLE_DETECTIVE }

SWEP.LimitedStock = true

But I am getting this

[ERROR] gamemodes/terrortown/gamemode/util.lua:107: attempt to index field ‘dt’ (a number value)

  1. GetIronsights - gamemodes/terrortown/gamemode/util.lua:107
  2. unknown - gamemodes/terrortown/gamemode/player.lua:1066

[ERROR] gamemodes/terrortown/gamemode/util.lua:107: attempt to index field ‘dt’ (a number value)

  1. GetIronsights - gamemodes/terrortown/gamemode/util.lua:107
  2. unknown - …es/terrortown/entities/weapons/weapon_tttbase/shared.lua:145

Please help guys

Now correct me if I am wrong, but I believe just switching the base will not solve the problem. I am not a great coder but I will say from experience that this may cause many of those problems. You will most likely need to check up on the codes in the base and make sure it doesn’t conflict with the other components of the SWEP. Unfortunately my abilities only take me that far. I cannot elaborate. I apologize.
Hope this helps!

Thanks for the help, although it does not help me that much

I am not sure if I am aloud to bump, but uh yeah, my thread is still now answered yet.

The dt table is created on an entity after InstallDataTables is called on them, but before SetupDataTables is. The problem here is that TTT expects the weapon to have certain DT values created on it, which you are not creating in the weapon.

You will need to figure out which ones, though.

hey, i have a working grapple hook that everyone on the server seems to like,
this is my server i use it on 50.31.65.245:27015 (intent for him to see if he likes it not to advertise)
and if you like it add me: http://steamcommunity.com/profiles/76561198024690138/

Thank you very much for the help, although I noticed something wired, I used the grapple hook (exactly the same as on my dedicated server) on a local server while testing something with my friend and it worked fine, I was using the TTT gamemode so I am not sure what is going on :c. But I think I will just grab another grapple hook, thanks for the help Kogitsune and Stotoma, as for you gmodproblems, you were no help :expressionless:

I know Kogitsune provided great information, but I am still stuck on this.