[Help] Charging using SetPlayerVelocity
#1

Hey everyone,

so Im making a "leap" or "charge" function, but the thing is that I dont really know how to do this. Im not sure how to use SetPlayerVelocity, because I've never used it before...
So here's what I've tried so far:

pawn Код:
new
    Float: X2,
    Float: Y2,
                       
    Float: X,
    Float: Y,
                       
    Float: Z;
                   
// Getting current player's position and the position infront of him
GetPlayerPos(playerid, X, Y, Z);
GetXYInFrontOfPlayer(playerid, X2, Y2, 2.0);
                   
// Calculating the difference between the current possition and the position infront of the player
X = X - X2;
Y = Y - Y2;
                   
// "Charging" him towards?
SetPlayerVelocity(playerid, X, Y, 0.2);
Basically, what I need to do is to "charge" player towards him, in the direction he's facing... Any ideas?

Thanks for help, I'll +rep anyone who helps me.
Reply


Messages In This Thread
[Help] Charging using SetPlayerVelocity - by Universal - 04.02.2012, 14:31
Re: [Help] Charging using SetPlayerVelocity - by thimo - 04.02.2012, 14:47
Re: [Help] Charging using SetPlayerVelocity - by Universal - 04.02.2012, 15:03
Re: [Help] Charging using SetPlayerVelocity - by Universal - 04.02.2012, 15:22
Re: [Help] Charging using SetPlayerVelocity - by thimo - 05.02.2012, 08:29

Forum Jump:


Users browsing this thread: 1 Guest(s)