Author Topic: Setting player velocity? [Resolved]  (Read 1537 times)

I've got an issue concerning a player's velocity when I push a "stationary" playertype onto the player. Basically, I have a weapon that can be deployed but I'm wanting the player to be fixated to the spot that he deployed. However, if I'm moving when I deploy, the pushed playertype is applied where I can't move, but causes the player to slide infinitly in the direction he was originaly moving before deploying.

Does anyone know a script snippet to set a player's velocity?
« Last Edit: February 19, 2012, 11:51:42 PM by FrogFreak »

Try %whateverclient.setVelocity(0,0,0);

I tried the .setvelocity but I was using ("0 0 0");.

I'll retry.

I've tried (0,0,0), that gave me a console error. I've tried (0 0 0), and I think that gave me a console error too. I tried "0 0 0" and didn't get any console error but the player still slid when deployed.

I've tried (0,0,0), that gave me a console error. I've tried (0 0 0), and I think that gave me a console error too. I tried "0 0 0" and didn't get any console error but the player still slid when deployed.
Because adding 0 0 0 does nothing cause it's not adding anything.


I've tried (0,0,0), that gave me a console error. I've tried (0 0 0), and I think that gave me a console error too. I tried "0 0 0" and didn't get any console error but the player still slid when deployed.
That's because you would need a constant loop setting the players to no velocity so they couldn't move. setVelocity sets the velocity, but that doesn't mean it can't go back down or go up.
« Last Edit: February 19, 2012, 07:33:57 PM by HellsHero »

..What?

It's Player::setVelocity(vector string)

e.g.

findClientByName("Slicksilver").player.setVelocity("10 0 10");

That's because you would need a constant loop setting the players to no velocity so they couldn't move. setVelocity sets the velocity, but that doesn't mean it can't go back down or go up.


Maybe I need to calrify just in case. The player's datablock is changed to a playertype that is incapable of movement. All I need is his velocity to be set to 0 in all axis just once, after that, he should be stationary for the rest of the time.

setVelocity("0 0 0"); is correct its probably a glitch in your script

addvelocity("0 0 0"); does nothing.
setvelocity("0 0 0"); freezes the player for a second.

I think freezing the player for a second should be enough since the stationary playertype is void of any movement control.

Maybe I'm using the wrong variable, I'll see about looking into it later. I'm currently not able to look at it as I am mobile.

I think freezing the player for a second should be enough since the stationary playertype is void of any movement control.

Maybe I'm using the wrong variable, I'll see about looking into it later. I'm currently not able to look at it as I am mobile.

Use a schedule that sets the player's velocity to "0 0 0" every second.

Why?

The player can't move on his own. If I SET his velocity to 0 for all axis, why would he contimue moving?

Maybe I'm using the wrong variable, I'll see about looking into it later. I'm currently not able to look at it as I am mobile.
%client.player.setVelocity("0 0 0");
You're calling the function incorrectly, do it like that.