20.01.2010, 19:14
Add this somewhere in your script...
...and then...
You don't need to check IsPlayerInAnyVehicle because GetPlayerState already does that.
pawn Код:
stock GetXYInFrontOfPlayer(playerid, &Float:x, &Float:y, Float:distance)
{
new Float:a;
GetPlayerPos(playerid, x, y, a);
GetPlayerFacingAngle(playerid, a);
x += (distance * floatsin(-a, degrees));
y += (distance * floatcos(-a, degrees));
}
pawn Код:
if((newkeys & KEY_FIRE) && (GetPlayerState(playerid) == 2))
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
GetXYInFrontOfPlayer(playerid, x, y, 1.0);
SetVehicleVelocity(GetPlayerVehicleID(playerid), x, y, 0.0);
}