04.02.2012, 15:22
This is what I've made, but it doesnt seem to work, just charges me into some random direction.
pawn Код:
new
Float: a,
Float: x1,
Float: y1,
Float: z1,
Float: x2,
Float: y2,
Float: z2,
Float: distance;
GetPlayerPos(playerid, x1, y1, z1);
GetPlayerFacingAngle(playerid, a);
GetXYInFrontOfPlayer(playerid, x2, y2, 2.0);
//distance = floatsqroot (floatpower ((x1 - x2), 2) + floatpower ((y1 - y2), 2) + floatpower ((z1 - z2), 2));
//x1 = x1 + (distance * floatsin(-a, degrees));
//y1 = y1 + (distance * floatcos(-a, degrees));
//distance = floatsqroot ((floatpower ((x1 - x2), 2)) + (floatpower ((y1 - y2), 2)));
x1 = floatsqroot( floatpower( (x1 - x2), 2) );
y1 = floatsqroot( floatpower( (y1 - y2), 2) );
//x2 = x1 + (x1 * floatsin(-a, degrees));
//y2 = y1 + (y1 * floatcos(-a, degrees));
SetPlayerVelocity(playerid, x1, y1, 0.1);