Prop Hunt 'prop lock' Code

Hi guys,

Been viewing Facepunch for many years but thought I should sign up!

I was wondering if anybody would look at my code below and tell me if you see anything wrong with it or if you think it might cause problems.


hook.Add( "Tick","PropLock",function()
	if pl:Team() != TEAM_PROPS then return end
	if ply:KeyPressed( IN_RELOAD ) && !ply:Freeze() then
		ply:Freeze( true )
	elseif ply:KeyPressed( IN_RELOAD ) && ply:Freeze() then
		ply:Freeze( false )
end )

Server works with it and nobody gets kicked with errors. I just want to make sure I’ve done it right - the idea is if a player on the Props team (TEAM_PROPS) presses reload they are frozen but still able to look around (they default to 3rd person at round start).

Thanks!

throw in an “end” after ply:Freeze( false ) to close the if statement

if you want to know if your parenthesis, brackets, and scopes are all correct, you should use Notepad++, it does it all for you

I want to use this code for my server, and what if I want the primary fire button when locking props? What code should I put instead of “IN_RELOAD?”

IN_ATTACK

They can all be found here:

That revive tho xP

Also to check if they are frozen use this:
ply:IsFrozen()
instead of:
ply:Freeze()