SHARE
TWEET

Untitled

a guest Nov 30th, 2017 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. new Float:info_ramps_on[][] = {
  3. {-1.125000,-5.474997,-0.300000,0.000000,0.000000,0.000000},  // Position ON
  4. {1.125000,-5.474997,-0.300000,0.000000,0.000000,0.000000}   // Position ON
  5. };
  6.  
  7. new Float:info_ramps_off[][] = {
  8. {-1.125000,0.150000,-0.300000,-16.200000,0.000000,0.000000}, // Position OFF
  9. {1.125000,0.150000,-0.300000,-16.200000,0.000000,0.000000}   // Position OFF
  10. };
  11.  
  12.  
  13. new myobject;
  14. new myobject2;
  15. dcmd_test(playerid, params[])
  16. {
  17.     #pragma unused params
  18.  
  19.     new vid = GetPlayerVehicleID(playerid);
  20.  
  21.     myobject = CreateObject(2893,0,0,-1000,0,0,0,100);
  22.     AttachObjectToVehicle(myobject, GetPlayerVehicleID(playerid), info_ramps_off[0][0],info_ramps_off[0][1],info_ramps_off[0][2],info_ramps_off[0][3],info_ramps_off[0][4], info_ramps_off[0][5]);
  23.     myobject2 = CreateObject(2893,0,0,-1000,0,0,0,100);
  24.     AttachObjectToVehicle(myobject2, GetPlayerVehicleID(playerid), info_ramps_off[1][0],info_ramps_off[1][1],info_ramps_off[1][2],info_ramps_off[1][3],info_ramps_off[1][4], info_ramps_off[1][5]);
  25.     SendClientMessage(playerid, COLOR_BLUE, "Attaché");
  26.    
  27.     MoveAttachedObject(myobject, vid, info_ramps_off[0][0],info_ramps_off[0][1],info_ramps_off[0][2],info_ramps_off[0][3],info_ramps_off[0][4], info_ramps_off[0][5], info_ramps_on[0][0],info_ramps_on[0][1],info_ramps_on[0][2],info_ramps_on[0][3],info_ramps_on[0][4], info_ramps_on[0][5], 0.2);
  28.     MoveAttachedObject(myobject2, vid, info_ramps_off[1][0],info_ramps_off[1][1],info_ramps_off[1][2],info_ramps_off[1][3],info_ramps_off[1][4], info_ramps_off[1][5], info_ramps_on[1][0],info_ramps_on[1][1],info_ramps_on[1][2],info_ramps_on[1][3],info_ramps_on[1][4], info_ramps_on[1][5], 0.2);
  29.     return 1;
  30. }
  31.  
  32.  
  33. enum e_move
  34. {
  35.     actif, // 0 new , 1 move
  36.     Float:gradualeX,
  37.     Float:gradualeY,
  38.     Float:gradualeZ,
  39.     Float:gradualeRX,
  40.     Float:gradualeRY,
  41.     Float:gradualeRZ,
  42.     Float:scale
  43. }
  44. new MoveInfo[100][e_move];
  45.  
  46.  
  47. forward MoveAttachedObject(oid, vid, Float:oX, Float:oY, Float:oZ, Float:orX, Float:orY, Float:orZ, Float:dX, Float:dY, Float:dZ, Float:drX, Float:drY, Float:drZ, Float:speed);
  48. public MoveAttachedObject(oid, vid, Float:oX, Float:oY, Float:oZ, Float:orX, Float:orY, Float:orZ, Float:dX, Float:dY, Float:dZ, Float:drX, Float:drY, Float:drZ, Float:speed)
  49. {
  50.  
  51.     if(!MoveInfo[oid][actif])
  52.     {
  53.         MoveInfo[oid][scale] = DistanceToPoint(oX, oY, oZ, dX, dY, dZ)/speed;
  54.         printf("%f", DistanceToPoint(oX, oY, oZ, dX, dY, dZ));
  55.  
  56.         MoveInfo[oid][gradualeX] = (dX-oX)/(MoveInfo[oid][scale]);
  57.         MoveInfo[oid][gradualeY] = (dY-oY)/(MoveInfo[oid][scale]);
  58.         MoveInfo[oid][gradualeZ] = (dZ-oZ)/(MoveInfo[oid][scale]);
  59.  
  60.         MoveInfo[oid][gradualeRX] = (drX-orX)/(MoveInfo[oid][scale]);
  61.         MoveInfo[oid][gradualeRY] = (drY-orY)/(MoveInfo[oid][scale]);
  62.         MoveInfo[oid][gradualeRZ] = (drZ-orZ)/(MoveInfo[oid][scale]);
  63.        
  64.         MoveInfo[oid][actif] = 1;
  65.        
  66.  
  67.         SetTimerEx("MoveAttachedObject", 100, false, "ddfffffffffffff", oid, vid, oX+MoveInfo[oid][gradualeX], oY+MoveInfo[oid][gradualeY], oZ+MoveInfo[oid][gradualeZ], orX+MoveInfo[oid][gradualeRX], orY+MoveInfo[oid][gradualeRY],orZ+ MoveInfo[oid][gradualeRZ], dX, dY, dZ, drX, drY, drZ, speed);
  68.     }
  69.     else if(MoveInfo[oid][actif] == 1) // update pos
  70.     {
  71.         if(MoveInfo[oid][scale] >0)
  72.         {
  73.             printf("scale : %f", MoveInfo[oid][scale]);
  74.             MoveInfo[oid][scale]-= 1.0;
  75.             AttachObjectToVehicle(oid, vid, oX+MoveInfo[oid][gradualeX], oY+MoveInfo[oid][gradualeY], oZ+MoveInfo[oid][gradualeZ], orX+MoveInfo[oid][gradualeRX], orY+MoveInfo[oid][gradualeRY], orZ+ MoveInfo[oid][gradualeRZ]);
  76.             SetTimerEx("MoveAttachedObject", 100, false, "ddfffffffffffff", oid, vid, oX+MoveInfo[oid][gradualeX], oY+MoveInfo[oid][gradualeY], oZ+MoveInfo[oid][gradualeZ], orX+MoveInfo[oid][gradualeRX], orY+MoveInfo[oid][gradualeRY], orZ+ MoveInfo[oid][gradualeRZ], dX, dY, dZ, drX, drY, drZ, speed);
  77.         }
  78.         else if(MoveInfo[oid][scale] <= 0) // l'échelle est fini, on attache l'objet a sa position finale
  79.         {
  80.             AttachObjectToVehicle(oid, vid, dX, dY, dZ, drX, drY, drZ);
  81.             MoveInfo[oid][actif] = 0;
  82.         }
  83.     }
  84.     return 0;
  85. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top