How to change jump height on gmod server?

I am trying to change the jump height for players on my gmod server (to make them jump higher).

How would I do this?

I tried a .lua file in autorun/server with this in it:

It didn’t work, and returned this when I booted up the server:

Also, what is a reasonable height? I do not know the default but heard it was 200 somewhere, somewhere else I heard 600.
I want the correct jump height for the mcskyisland TTT map (the default jump height doesn’t get the player more than 1/2 up a block).

The reason it fails is because you’re trying to change the jumping power on an uninitialized object (Player.) You won’t be able to use a one liner to change the jump height for everyone on the server because the server population isn’t fixed and players die/respawn.

The easy way to do something like this would be to write a function that modifies the jump height of a player and have it be triggered by the player spawn hook. That way, when a player spawns, they have their jump height modified. It won’t be very efficient and isn’t elegant but it would work.

If you goto codehire and pirchase ulx extended it comes with lots of good commands including jump height

Maurits shows a clearer and better example of this:

You could try what GiGaBiTe suggested. Do something like hook.Add( “PlayerSpawn” and then have that function inside?

I am really a noob at Lua programming, could you help me?
What would the final script look like?

[editline]6th December 2013[/editline]

Ok, this is what I tried (didn’t work):

Inside init.lua, you’d want to place something like




function GM:PlayerSpawn( ply )
ply:SetJumpPower( 800)
end



You don’t want to override gamemode functions for that.




hook.Add("PlayerSpawn","my awesome stuff",function ( ply )
ply:SetJumpPower( 800)
end )



Where is lua.init? I cant find it… (found it vv)

And is there supposed to be a space before 800 or not?
Also, what do I replace “my awesome stuff” with?

EDIT: I assume you mean the init.lua located in terrortown gamemode.

Just make a file in lua/autorun/server

name it whatever you want and put the code in.


hook.Add("PlayerSpawn","my awesome stuff",function ( ply )
ply:SetJumpPower( 800)
end )

Ok thanks, I found the init.lua in terrortown, put in the code at the end and it worked like a charm.