04.02.2012, 14:31
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:
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.
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);
Thanks for help, I'll +rep anyone who helps me.