28.02.2013, 18:04
Hello ,i have take this script,https://sampforum.blast.hk/showthread.php?tid=376910 for edit objet on a vehicle, but i woold like to upgrade this script and use all angles,no only the z.I think add the tangean but i'm lost.
Can you help me ?
Ps:Sorry for my bad english i'm french
Can you help me ?
Ps:Sorry for my bad english i'm french
Код:
public OnPlayerEditObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) { if(response == EDIT_RESPONSE_CANCEL) { } if(response == EDIT_RESPONSE_FINAL) { new vehicleid=GetPlayerVehicleID(playerid); new Float:X,Float:Y,Float:Z,Float:A; GetVehiclePos(vehicleid, X, Y, Z); GetVehicleZAngle(vehicleid, A);//For all angles use GetVehicleRotationQuat new Float:ofx, Float:ofy, Float:ofz, Float:ofaz; new Float:finalx, Float:finaly; new Float:px, Float:py, Float:pz, Float:roz; GetVehiclePos(vehicleid, px, py, pz); GetVehicleZAngle(vehicleid, roz); ofx = x-px; ofy = y-py; ofz = z-pz; ofaz = rz-roz; finalx = ofx*floatcos(roz, degrees)+ofy*floatsin(roz, degrees); finaly = -ofx*floatsin(roz, degrees)+ofy*floatcos(roz, degrees); AttachObjectToVehicle(AttachVehOb[playerid], vehicleid, finalx, finaly, ofz, rx, ry, ofaz); } return 1; }