TTT grappling hook

Hi guys,
So I wanted to add the grappling hook SWEP onto my TTT server. This would have been the first SWEP I would have changed into TTT form, so I downloaded the grappling hook SWEP from, then I opened the file and couldn’t figure out what to do. So what I did was copy the weapon/shared.lua file and paste it into my weapon_ttt_grapplinghook/shared.lua file. I’m not quite sure why. Then when I went to test it, it worked. The only problem was… if somebody used it while another person was looking at them using it, they got kicked for LUA errors. If they weren’t looking or near the grappling hook when it was used they were fine, it was only when they saw it. Doesn anyone have any ideas on how to make this a successful TTT SWEP? I’ve been trying for almost 4 hours now and I’m at a loss. Any help is appreciated.

If it’s the grapple I updated ( and then broke) it could be because in the cl_init there is a function in there for the material the “rope” is, and it you are tying to render it when it doesn’t exist then you may crash.

Frist of all, add this line to your server.cfg while coding/developing

“sv_kickerrornum” “0”

What error do you get? You should post it here

[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

And when I added “sv_kickerrornum” “0” to the server cfg and tested it, they could see the weapon but when I used it the couldn’t see the rope, so I think it might be what pandaman said.

If this isn’t fixed by time I get home I’ll post the fix, I’ve fixed it before but I forgot what I did. I think it might have been changing the name of the dt since it conflicted with a shotgun.

Ok thank you!

Still haven’t figured it out =\

When you point at a place does the rope come out at all and let you move? If not, Did you add “ttt_grapple_distance 9999999” in server.cfg ?

Ok so I checked and I think I changed it do a table value on self. so self.dt
That is all I can see from my fixed version.

[editline]10th May 2013[/editline]

I would also like to point out what you do need cl_init and init.lua along with shared.

How would you do the self.dt?
Sorry xD I’m an LUA nooby

self.dt is a value in a the “self” table with an index of “dt”
Basicly you just replace everything that uses the value of dt with self.dt
So instead of using a networked variable it uses a table on the weapon.

I’m not sure I understand.
So the only file I’m dealing with is the ttt_weapon_grapplinghook correct?
And what files from the am I using?
Do I also use the files from the tracer or just the weapon?
And do I just change everything that says dt to self.dt?
Sorry, xD I just don’t get it

Let me look at the pack again and then I’ll tell you what I did.

[editline]11th May 2013[/editline]

You’re also going to want to use the newer version

[editline]11th May 2013[/editline]

Ok so This is what you need to do.

  1. Put the trace1 in your TTT entities, it needs no changes.
  2. Put cl_init, init and shared into one file.
    Make sure you use

if (SERVER) then
    --init code

when you are putting in the init file and

if (CLIENT) then
     --cl_init code

before the cl_init
then put shared after those two.
3) Post any errors you get again. You will most likely get the dt error again.

Are all three in the same file or just cl_init and init

I shoved it all into one shared.lua and it didnt work =(

did you get any errors?

it said it couldnt find cl_init.lua
the lua file i put them all in was called shared.lua idk if that’s what did it

zerothefallen told me to post this because he’s banned atm

he fixed the weapon, can probly contact him here if needed

Thank you so much!!!