AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Coding MM:S Plugins & SM Extensions (https://forums.alliedmods.net/forumdisplay.php?f=75)
-   -   Player View Angles (https://forums.alliedmods.net/showthread.php?t=274667)

xXDeathreusXx 11-12-2015 16:55

Player View Angles
 
Can they be changed easily?

I found a function within CBasePlayer that I think can do it (SnapEyeAngles) but the project I'm working in has a problem trying to include the files that contain CBasePlayer, throwing a slew of errors like m_hOwnerEntity is undefined, m_hMoveParent undefined, m_hUseEntity, n_hVehicle, m_hObserverTarget, m_hZoomerOwner, m_hOwner, m_hLightingOrigin/Relative, m_hCtrl, m_hActiveWeapon, all undefined for some reason

I have all the environment variables set up correctly, and I included several required files, but including cbase.h throws many errors, and including just player.h does too

So my main question is 2 fold: Is there a way to change player view angles without including this, or is there a way to fix these problems and just use the premade stuff

donrevan 11-12-2015 17:41

Re: Player View Angles
 
Well, tampering with the players usercmds is probably the best solution.
https://forums.alliedmods.net/showthread.php?t=255101

xXDeathreusXx 11-12-2015 19:30

Re: Player View Angles
 
Quote:

Originally Posted by donrevan (Post 2362499)
Well, tampering with the players usercmds is probably the best solution.
https://forums.alliedmods.net/showthread.php?t=255101

I have a usercmd hook, setting cmd->viewangle does nothing, just like in a SourceMod plugin, if you do ang=ang and return Plugin_Changed it doesn't actually change the players view

Edit: And actually, in the hl2sdk in usercmd.h, it has a code block that turns some parts of the hook into local only, viewangle is one, at least that's what I'm led to believe

xXDeathreusXx 11-12-2015 21:56

Re: Player View Angles
 
WELP, everything in this has become irrelevant

It's sending the angles serverside, but not clientside, I'm shooting people behind me, the equivelant of a silent aim aimbot

It's good enough for me, but meh

donrevan 11-13-2015 04:32

Re: Player View Angles
 
If you want visible view angle changes you can call CBaseAnimating?::Teleport(virtual function, no signature required).

Teleport(Vector const *newPos, QAngle const *newAngles, Vector const *newVelocity)
just pass NULL to newPos and newVelocity

xXDeathreusXx 11-13-2015 13:26

Re: Player View Angles
 
Quote:

Originally Posted by donrevan (Post 2362593)
If you want visible view angle changes you can call CBaseAnimating?::Teleport(virtual function, no signature required).

Teleport(Vector const *newPos, QAngle const *newAngles, Vector const *newVelocity)
just pass NULL to newPos and newVelocity

I see

This is where the original problem comes in, baseentity.h has errors

Edit: Looking at the teleport code, I see it also just uses SnapEyeAnles

Edit 2: I looked at SnapEyeAngles, and it uses CPlayerState, which IServerGameClients can retrieve and use, so I used the method SnapEyeAngles uses and it works!

Spoiler

asherkin 11-13-2015 14:15

Re: Player View Angles
 
Congratulations, you've learnt why SM's gamedata files exist.

xXDeathreusXx 11-17-2015 19:39

Re: Player View Angles
 
A new problem emerged that the eye angles never leave 0.0 in pitch

asherkin 11-18-2015 02:58

Re: Player View Angles
 
I think you're probably looking at roll instead of pitch.

xXDeathreusXx 11-18-2015 22:34

Re: Player View Angles
 
Quote:

Originally Posted by asherkin (Post 2364115)
I think you're probably looking at roll instead of pitch.

No, it's pitch, I can't get it to leave 0.0 when it finds a target, it snaps almost like it get's locked

The piece of code I have was being used on bots


All times are GMT -4. The time now is 21:15.

Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.