shourya90

Untitled

Jan 4th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.37 KB | None | 0 0
  1. public OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz)
  2. {
  3.    
  4.    SendClientMessage(playerid, -1, "0");
  5.    if(EdtVehObj[playerid])
  6.    {
  7.         SendClientMessage(playerid, -1, "1");
  8.         if(objectid == AttachingObjects[playerid])
  9.         {
  10.             SendClientMessage(playerid, -1, "2");
  11.             new i = GetPVarInt(playerid, "VehObjChoose");
  12.             MoveDynamicObject(objectid, x, y, z, 10.0, rx, ry, rz);
  13.             if(response == EDIT_RESPONSE_FINAL)
  14.             {
  15.                    
  16.                     SendClientMessage(playerid, -1, "3");
  17.                     SendClientMessage(playerid, 0xfce80cFF, "Finished Edition.");
  18.                    
  19.                     new Float:ofx, Float:ofy, Float:ofz, Float:ofaz;
  20.                     new Float:finalx, Float:finaly;
  21.                     new Float:px, Float:py, Float:pz, Float:roz;
  22.                     GetVehiclePos(SelectVehObj[playerid], px, py, pz);
  23.                     GetVehicleZAngle(SelectVehObj[playerid], roz);
  24.                     ofx = x-px;
  25.                     ofy = y-py;
  26.                     ofz = z-pz;
  27.                     ofaz = rz-roz;
  28.                     finalx = ofx*floatcos(roz, degrees)+ofy*floatsin(roz, degrees);
  29.                     finaly = -ofx*floatsin(roz, degrees)+ofy*floatcos(roz, degrees);
  30.                     AttachDynamicObjectToVehicle(objectid, SelectVehObj[playerid], finalx, finaly, ofz, rx, ry, ofaz);
  31.                  
  32.                     DeletePVar(playerid, "VehObjChoose");
  33.                     EdtVehObj[playerid] = false;
  34.                  
  35.             }
  36.             else if(response == EDIT_RESPONSE_CANCEL)
  37.             {
  38.                     DestroyDynamicObject(objectid);
  39.                     DeletePVar(playerid, "VehObjChoose");
  40.                     EdtVehObj[playerid] = false;
  41.                    
  42.             }
  43.         }
  44.         return 1;    
  45.  
  46.     }
  47.  
  48.    
  49.     #if defined Vob_OnPlayerEditDynamicObject
  50.         return Vob_OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
  51.     #else
  52.         return 1;
  53.     #endif
  54. }
  55. #if defined _ALS_OnPlayerEditDynamicObject
  56.     #undef OnPlayerEditDynamicObject
  57. #else
  58.     #define _ALS_OnPlayerEditDynamicObject
  59. #endif
  60.  
  61. #define OnPlayerEditDynamicObject Vob_OnPlayerEditDynamicObject
  62. #if defined Vob_OnPlayerEditDynamicObject
  63.     forward Vob_OnPlayerEditDynamicObject(playerid, objectid, response, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz);
  64. #endif
Add Comment
Please, Sign In to add comment