Guest User

Untitled

a guest
Nov 17th, 2020
48
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public OnPlayerEditDynamicObject(playerid, playerobject, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz) {
  2.     SetDynamicObjectPos(objectid, x, y, z);
  3.     SetDynamicObjectRot(objectid, rx, ry, rz);
  4.     Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_OFFSET_X, x);
  5.     //Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_OFFSET_Y, y);
  6.     //Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_OFFSET_Z, z);
  7.     //Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_X, rx);
  8.     //Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Y, ry);
  9.     //Streamer_SetFloatData(STREAMER_TYPE_OBJECT, objectid, E_STREAMER_ATTACH_R_Z, rz);
  10.  
  11.     if(response == EDIT_RESPONSE_FINAL) {
  12.         if( GetPVarInt(playerid, "IsVipEdit") == 1) {
  13.             new veh = GetPlayerVehicleID(playerid);
  14.             SetPVarInt(playerid, "IsVipEdit", 0);
  15.             new idd = caridxx[veh];
  16.             new Float:ofx, Float:ofy, Float:ofz, Float:ofaz;
  17.             new Float:finalx, Float:finaly;
  18.             new Float:px, Float:py, Float:pz, Float:roz;
  19.             GetVehiclePos(veh, px, py, pz);
  20.             GetVehicleZAngle(veh, roz);
  21.             ofx = x-px;
  22.             ofy = y-py;
  23.             ofz = z-pz;
  24.             ofaz = rz-roz;
  25.             finalx = ofx*floatcos(roz, degrees)+ofy*floatsin(roz, degrees);
  26.             finaly = -ofx*floatsin(roz, degrees)+ofy*floatcos(roz, degrees);
  27.             CarInfo[idd][cVX] = finalx;
  28.             CarInfo[idd][cVY] = finaly;
  29.             CarInfo[idd][cVZ] = ofz;
  30.             CarInfo[idd][cVRX] = rx;
  31.             CarInfo[idd][cVRY] = ry;
  32.             CarInfo[idd][cVRZ] = ofaz;
  33.             new query[248];
  34.             mysql_format(SQL,query,sizeof query,"UPDATE `cars` SET `X` = '%f',`Y` = '%f',`Z` = '%f',`RX`='%f',`RY`='%f',`RZ`='%f' WHERE `ID` = '%d' LIMIT 1",CarInfo[idd][cVX],CarInfo[idd][cVY],CarInfo[idd][cVZ],CarInfo[idd][cVRX],CarInfo[idd][cVRY],CarInfo[idd][cVRZ],CarInfo[idd][cID]);
  35.             mysql_tquery(SQL,query,"","");
  36.             //if(IsValidDynamicObject(vText[veh])) DestroyDynamicObject(vText[veh]);
  37.             //new name[82];
  38.             //vText[veh] = CreateDynamicObject(19327, finalx, finaly, ofz, rx, ry, ofaz);
  39.             //format(name, sizeof(name), "{%s}%s", CarInfo[idd][cVipnamecolor], CarInfo[idd][cVipname]);
  40.             //SetDynamicObjectMaterialText(vText[veh], 0,name, OBJECT_MATERIAL_SIZE_256x128, "Arial", CarInfo[idd][cVipSize], 1, -1, 0, 1);
  41.             AttachDynamicObjectToVehicle(objectid, veh,CarInfo[idd][cVX],  CarInfo[idd][cVY],  CarInfo[idd][cVZ],  CarInfo[idd][cVRX],  CarInfo[idd][cVRY],  CarInfo[idd][cVRZ]);
  42.         }
  43.     }
  44.     if(response == EDIT_RESPONSE_CANCEL)
  45.     {
  46.         new veh = GetPlayerVehicleID(playerid);
  47.         VIPNameVehicle(veh);
  48.     }
  49.     return 1;
  50. }
RAW Paste Data Copied