Hi, I am working on a code. The problem is if I go to a car in the area, I want you to throw me backwards. This is the code I'm working on, but I did not get the result I wanted. Can you help me ?
Код:
new Float: vPos[4];
GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
GetVehicleZAngle(GetPlayerVehicleID(playerid), vPos[3]);
GetXYInFrontOfPlayer(playerid, vPos[0], vPos[1], 6.0);
SetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
SetVehicleZAngle(GetPlayerVehicleID(playerid), vPos[3]);
new Float:sPos[3];
GetVehicleVelocity(GetPlayerVehicleID(playerid), sPos[0], sPos[1], sPos[2]);
SetVehicleVelocity(GetPlayerVehicleID(playerid), sPos[0] + 1.5, sPos[1], sPos[2]);
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float: a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
if (GetPlayerVehicleID(playerid)) GetVehicleZAngle(GetPlayerVehicleID(playerid), a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}