• Prop Hunt 'prop lock' Code
    5 replies, posted
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. [CODE]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 )[/CODE] 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: [url]http://wiki.garrysmod.com/page/Enums/IN[/url]
That revive tho xP
Also to check if they are frozen use this: ply:IsFrozen() instead of: ply:Freeze()
Sorry, you need to Log In to post a reply to this thread.