21.01.2012, 20:47
Thanks but it did'nt worked out..
anyone help appreciated!
anyone help appreciated!
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(KEY_FIRE))
{
/*if (IsPlayerInAnyVehicle(playerid))
{
AddVehicleComponent(GetPlayerVehicleID(playerid), 1010);
}*/
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
new Float:vehx, Float:vehy, Float:vehz, Float:distance, Float:angle, Float:x2, Float:y2;
GetVehiclePos(currentveh, vehx, vehy, vehz); //x+0.13 y-5.30 z+0.27
GetVehicleDistanceFromPoint(currentveh, vehx, vehy, vehz);
GetVehicleZAngle(currentveh, angle);
GetXYBehindPoint(vehx, vehy, x2, y2, angle, distance);
CreateObject(1225,x2,y2,vehz,0.00000000,0.00000000,0.00000000); //object(barrel4) (1)
}
return 1;
}
stock GetXYBehindPoint(Float:x,Float:y,&Float:x2,&Float:y2,Float:angle,Float:distance)
{
x2 = x - (distance * floatsin(-angle,degrees));
y2 = y - (distance * floatcos(-angle,degrees));
}