Raised This Month: $32 Target: $400
 8% 

Setting player velocity?


Post New Thread Reply   
 
Thread Tools Display Modes
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 01-10-2014 , 17:20   Re: Setting player velocity?
Reply With Quote #21

Quote:
Originally Posted by xf117 View Post
Because there is no float m_vecVelocity[0] prop. There is only vector m_vecVelocity prop which can be set by
PHP Code:
decl Float:vecCurrentVel[3];
GetEntPropVector(clientProp_Data"m_vecVelocity"vecCurrentVel);
vecCurrentVel[0] = 9001.0;
SetEntPropVector(clientProp_Data"m_vecVelocity"vecCurrentVel); 
Untested, only based on your data.
I will try this.

The dump of netprops has them listed as floats [0], [1] and [2]. This is why I am a little confused, since Basevelocity is listed as a single vector.
CoolJosh3k is offline
CoolJosh3k
AlliedModders Donor
Join Date: Mar 2010
Old 01-12-2014 , 05:41   Re: Setting player velocity?
Reply With Quote #22

It seems that doing:
Code:
SetEntPropVector(client, Prop_Data, "m_vecVelocity", vecNewVelocity);
Does not work. It seems like the value is enforced per frame, by the server. I get a rubber band effect. Even trying to set the player's velocity to zero, doesn't work for me.

Looks like I have finally got things working as I want, but I cannot stop the players movement. Here is the code I have to stop the player:

PHP Code:
    //reset player velocity
    
decl Float:fVelocity_Current[3];
    
decl Float:fVelocity[3];
    
GetEntPropVector(clientProp_Data"m_vecVelocity"fVelocity_Current);
    
fVelocity[0] = (fVelocity_Current[0] * -1);
    
fVelocity[1] = (fVelocity_Current[1] * -1);
    
fVelocity[2] = (fVelocity_Current[2] * -1);
    
SetEntPropVector(clientProp_Data"m_vecBaseVelocity"fVelocity); 
Presuming that m_vecBaseVelocity adds to m_vecVelocity, I am taking the current velocity and inverting it, so that the value added results in a 0.
Sadly, I cannot see any effect in testing.
I am doing this with a 1 second timer, that runs after the player's velocity is modified.

Hopefully when all this is solved, someone else out there will Google this and make use of it too.

Update:

I was rather tired, so missed an obvious solution... use that teleport function:
PHP Code:
    new Float:fVelocity[3] = {0.00.0, -9001.0};
    
TeleportEntity(clientNULL_VECTORNULL_VECTORfVelocity); 
In order to prevent players dying from fall damage, I am granting a tiny bit of uber on them.

Last edited by CoolJosh3k; 01-13-2014 at 01:10.
CoolJosh3k is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:03.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode