[Prophunt] item pickup + prop rotation

Hello, I have two questions,

First of all, is it normal that a hunter can’t pick up random props around the map with “E”? So like you can pick up items to check if they are humans or not,
If it’s normal hunters can’t do this, is there any way to enable it? Because i’d like to enable it in my server.

Second, is there any code or custom prophunt gamemode online for free that enables props to rotate themself? For example by holding right click.

Thanks in advance

  1. The prop can be picked up if it is supposed to be picked up. There are some random props in maps not to be picked up.

I really, as a hunter, can’t pick up anything, also, which version should I use from prophunt?
I’m using: http://steamcommunity.com/sharedfiles/filedetails/?id=135509255
at the moment

Here you go: http://wiki.garrysmod.com/page/GM/AllowPlayerPickup

If you’re modifying behavior use hook.Add and only return true / false for SPECIFIC behavior because it will prevent the GM: function from firing if non-nil value is returned.

If you’re writing a game-mode use the GM: function…

You could set up a system so that if a player is holding attack2 that based on the ▲Pitch/Yaw/Roll, that ▲ value is applied to the prop angles by setting them… ▲ = Delta, or the change-in meaning if Yaw was 100 and you moved +10 then the ▲Yaw would be 10 for that frame or so… Then you can have smooth rotation…

You can do that all on the server but you could also use a shared hook… Some to look at would be InputMouseApply, SetupMove, CreateMove, Move… on the wiki. http://wiki.garrysmod.com/

Also, Welcome to Facepunch, here are some helpful posts, etc…

Generalized Lua Help ( Links to Wikis, Answers the question of “Where do I post a simple question or DarkRP Specific question”, links to other resources compiled by forum members )

Useful Programs ( SteamCMD, Autosizer, Desktops, Process Explorer ) and Notepad++ Upgrades

Thanks for the info,
Can I maybe ask where I should imply this, in which file should I do this?


Where should I create a function to do the prop rotation? with lua file etc?

Response via PM:

I’d recommend using SetupMove hook which is shared. You can detect IN_ keys natively using _p:KeyDown( IN_ATTACK2 ) and you can also check the _p:EyeAngles( ), and get the change of eye angles from the previous frame ( basically set up a previous example so…

// Inside SetupMove shared hook would work if InputMouseApply isn't shared.
if ( _p:KeyDown( IN_ATTACK2 ) then
	local _ang = _p:EyeAngles( );
	local _last_ang = ( _p.LastAng && _p.LastAng || _ang );
	local _difference_y = math.AngleDifference( _ang.y, _last_ang.y );
	local _difference_x = math.AngleDifference( _ang.x, _last_ang.x );
	_p.LastAng = _ang;

	// This is where you'd modify the prop angle based on the data...
	-- ...

is the basic format… Then, based on the difference values you can modify your rotation ( inside the if statement with the IN_ATTACK2 KeyDown call… )…

Hopefully this helps. Feel free to add me on Steam.


I’ve tried something new and put this in init.lua, still doesn’t work:

[LUA]function PropOrientationLock( ply )
local yaxis = ply:GetAngles().y
local zaxis = ply:GetAngles().z
local axislock = Vector(ply:GetAngles().x,yaxis+0,zaxis+0)
ply:SetAngles( axislock)

hook.Add(“PlayerBindPress”,“PH_Orientation”, function(ply, bind, pressed)
if (pressed and bind == “+attack2” and ply:team() == TEAM_PROPS) then