I wanted to make a code for prophunt where if you press (for example) 'C', the angles of your prop as you see it will become the angles of your prop as the hunters see it.
I figured the easiest way to do this would be getting the angles client-side, and setting them server-side.
I can't quite figure out how to do that tho....
Any guidance is appreciated ^^
I made this a while ago, I ended up parenting the prop entity to the player then setting the angles serverside, but for some reason they didn't update on the client, so I also calculated the angle of the prop clientside.
Use these:
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/Move]GM/Move[/url]- Set the prop angles in that hook
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/EyeAngles]Entity:EyeAngles[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PreRender]GM/PreRender[/url]- Rotate the entity clientside in this hook
It's not the best way to do it, but every other way I tried failed.
[QUOTE=meharryp;48271248]I made this a while ago, I ended up parenting the prop entity to the player then setting the angles serverside, but for some reason they didn't update on the client, so I also calculated the angle of the prop clientside.
Use these:
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/Move]GM/Move[/url]- Set the prop angles in that hook
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Entity/EyeAngles]Entity:EyeAngles[/url]
[img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/PreRender]GM/PreRender[/url]- Rotate the entity clientside in this hook
It's not the best way to do it, but every other way I tried failed.[/QUOTE]
Thanks for your help but that's not really what I'm having trouble with (If I'll fail eventually, meh)
I just don't know how to get the angles clientside, then setting them serverside
[QUOTE=JasonMan34;48273897]Thanks for your help but that's not really what I'm having trouble with (If I'll fail eventually, meh)
I just don't know how to get the angles clientside, then setting them serverside[/QUOTE]
Use [img]http://wiki.garrysmod.com/favicon.ico[/img][url=http://wiki.garrysmod.com/page/Entity/EyeAngles]Entity:EyeAngles[/url] and then send them over a net message.
In the Move hook, do ply.ph_prop:SetAngles( ply:EyeAngles() ), there's no need to have to network anything.
[QUOTE=meharryp;48274163]In the Move hook, do ply.ph_prop:SetAngles( ply:EyeAngles() ), there's no need to have to network anything.[/QUOTE]
Right, I forgot its also serverside -,-
[QUOTE=meharryp;48274163]In the Move hook, do ply.ph_prop:SetAngles( ply:EyeAngles() ), there's no need to have to network anything.[/QUOTE]
But wouldn't that make it so it changes the direction of the prop whenever he moves?
I want it to change when you hit a button
If your using any of the IN_ keys ([url]http://wiki.garrysmod.com/page/Enums/IN[/url]), you can do something like this:
[lua]
ply.Rotate = true
[/lua]
Then in your move hook:
[lua]
if ply.Rotate then
-- Set angles
end
[/lua]
Otherwise, use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/input/IsKeyDown]input.IsKeyDown[/url] in a think hook, or if you want C like in your example use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/GM/ContextMenuOpen]GM/ContextMenuOpen[/url]
[QUOTE=meharryp;48274163]In the Move hook, do ply.ph_prop:SetAngles( ply:EyeAngles() ), there's no need to have to network anything.[/QUOTE]
Ok so this was fine but the problem is I only want to change their direction on one axis.
I want them turning right & left, not up & down.
What do I do about that?
Sorry, you need to Log In to post a reply to this thread.