LUA script that hides weapons when on ladders.

Title says it all.
Oh, and make it lock the weapon functions.

Wow, a request for something conventional and actually useful. Dont see that every day o_o

Are you talking about first person, third person, or both? Because I know for a fact you can hide the viewmodels easily, but if you want to actually hide the gun’s world model I think you’d have to either get hacky with player anims or mess with the SWEP code.

Probbably both, and a ladder climb animation would give a finishing touch

Find someone thats pro with the anim api, making it so they can’t use/see their weapons is easy.

Well, if somebody can, just give us the lua for hiding weapons viewmodels when on a ladder, I don’t really care about world models atm.

Here:
[lua]
PMeta = FindMetaTable(“Player”)

function PMeta:IsOnLadder( )

if ( self:GetMoveType( ) == MOVETYPE_LADDER ) then
	return true
end

return false

end

function CheckLadder( )

for k, ply in pairs( player.GetAll() ) do
	if ( ply:IsOnLadder( ) ) then
		ply:DrawViewModel(false)
		ply:DrawWorldModel(false)
		return;
	end
	
	ply:DrawViewModel(true)
	ply:DrawWorldModel(true)
end

end
hook.Add( “Think”, “ThinkCheckLadder”, CheckLadder )
[/lua]

Hides world/view models. I could not get it to play a animation, sorry.

It goes in lua/autorun/server/SomeName.lua

helps me for rp :slight_smile:

Make it so weapon doesn’t shoot, yes? Maybe?

If you make animations for ladders, people will moan that the feet and hands arnt on the “bars”

Triv’s method should work fine.

Wow that’s excellent, thanks for that I always was curious about this :downs:

Permission to release with your name in the Credits???

Im working on some other functions to make it better, but if you put http://www.garrysmod.org/user/trivkz then ok.