adri1

test

Apr 10th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.82 KB | None | 0 0
  1. ///// ANGULO X * cps ANGULO Y = DIF 90 - RESULTADO
  2. //Experimental FS by adri1
  3. //==============================================================================
  4.  
  5. #include <a_samp>
  6. #include <zcmd>
  7. #include <sscanf2>
  8.  
  9. new MOVEBASE, st,// count,
  10. Float:angle = 0.0, Float:aVel, Float:aAcc,
  11.  
  12. Float:Origin_X = 0.0, Float:Origin_Y = 25.0, Float:len = -25.0, Float:damping = 1.0,
  13. Text:TDEditor_TD;
  14.  
  15. public OnFilterScriptInit()
  16. {
  17.  
  18. CreateObject(1946, 0.0, 0.0, Origin_Y, 0.00000, 0.00000, 0.00000, 1000.0);
  19. MOVEBASE = CreateObject(19130 , 0.0, 0.0, 0.0, 0.00000, 0.00000, 0.00000, 1000.0);
  20.  
  21. //AttachObjectToObject(CreateObject(19740, 0.00000, 0.00000, 6.25000, 0.00000, 90.00000, 180.00000), MOVEBASE, 0.0, 0.0, 6.25, 0.0, 90.0, 180.0);
  22. //AttachObjectToObject(CreateObject(19740, 0.00000, 0.00000, 6.25000, 0.00000, 90.00000, 180.00000), MOVEBASE, 0.0, 0.0, 18.75, 0.0, 90.0, 180.0);
  23. new SEATBASE = CreateObject(18886, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
  24. //SetObjectMaterial(SEATBASE, 0, 18646, "matcolours", "samporange");
  25. AttachObjectToObject(SEATBASE, MOVEBASE, 0.0, 0.0, -0.5, 0.0, 0.0, 0.0);
  26.  
  27.  
  28. new seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  29. AttachObjectToObject(seat, SEATBASE, -0.6162, 2.0824, -0.4397, 0.0000, 0.0000, 195.0000);
  30. SetObjectMaterial(seat, 0, 1562, "ab_jetseat", "mp_jet_seat", 0xFF00CCFF);
  31. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  32. AttachObjectToObject(seat, SEATBASE, -1.4831, 1.4819, -0.4397, 0.0000, 0.0000, 225.0000);
  33. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  34. AttachObjectToObject(seat, SEATBASE, -2.1035, 0.5745, -0.4397, 0.0000, 0.0000, 255.0000);
  35. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  36. AttachObjectToObject(seat, SEATBASE, -2.1016, -0.5955, -0.4397, 0.0000, 0.0000, 285.0000);
  37. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  38. AttachObjectToObject(seat, SEATBASE, -1.5044, -1.5795, -0.4397, 0.0000, 0.0000, 315.0000);
  39. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  40. AttachObjectToObject(seat, SEATBASE, -0.5645, -2.1727, -0.4397, 0.0000, 0.0000, 345.0000);
  41. SetObjectMaterial(seat, 0, 1562, "ab_jetseat", "mp_jet_seat", 0xFF0000FF);
  42. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  43. AttachObjectToObject(seat, SEATBASE, 0.573, -2.1273, -0.4397, 0.0000, 0.0000, -345.0000);
  44. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  45. AttachObjectToObject(seat, SEATBASE, 1.5295, -1.5389, -0.4397, 0.0000, 0.0000, -315.0000);
  46. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  47. AttachObjectToObject(seat, SEATBASE, 2.1129, -0.5817, -0.4397, 0.0000, 0.0000, -285.0000);
  48. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  49. AttachObjectToObject(seat, SEATBASE, 2.0814, 0.5617, -0.4397, 0.0000, 0.0000, -255.0000);
  50. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  51. AttachObjectToObject(seat, SEATBASE, 1.5124, 1.5704, -0.4397, 0.0000, 0.0000, -225.0000);
  52. seat = CreateObject(1562, 0, 0, 0, 0.00, 0.00, 0.00);
  53. AttachObjectToObject(seat, SEATBASE, 0.5522, 2.0793, -0.4397, 0.0000, 0.0000, -195.0000);
  54.  
  55. CreateObject(18981, -3.50000, 0.00000, 0.00000, 0.00000, 0.00000, 0.00000);
  56. CreateObject(18981, -3.50000, -25.00000, 25.00000, 0.00000, 0.00000, 0.00000);
  57. CreateObject(18981, -3.50000, 25.00000, 25.00000, 0.00000, 0.00000, 0.00000);
  58. SetObjectMaterial(CreateObject(18981, -3.50000, -25.00000, 0.00000, 0.00000, 0.00000, 0.00000), 0, 18646, "matcolours", "yellow");
  59. SetObjectMaterial(CreateObject(18981, -3.50000, 25.00000, 0.00000, 0.00000, 0.00000, 0.00000), 0, 18646, "matcolours", "yellow");
  60. SetObjectMaterial(CreateObject(18981, -3.50000, 0.00000, 25.00000, 0.00000, 0.00000, 0.00000), 0, 18646, "matcolours", "yellow");
  61.  
  62.  
  63. TDEditor_TD = TextDrawCreate(500.000000, 355.000000, "Initial_speed:_50~n~Rotation:_90~n~Angle:_30.0~n~Gravity:_9.8");
  64. TextDrawLetterSize(TDEditor_TD, 0.400000, 1.600000);
  65. TextDrawTextSize(TDEditor_TD, 650.000000, 0.000000);
  66. TextDrawAlignment(TDEditor_TD, 1);
  67. TextDrawColor(TDEditor_TD, -1);
  68. TextDrawUseBox(TDEditor_TD, 1);
  69. TextDrawBoxColor(TDEditor_TD, 255);
  70. TextDrawSetShadow(TDEditor_TD, 0);
  71. TextDrawSetOutline(TDEditor_TD, 0);
  72. TextDrawBackgroundColor(TDEditor_TD, 255);
  73. TextDrawFont(TDEditor_TD, 1);
  74. TextDrawSetProportional(TDEditor_TD, 1);
  75. TextDrawSetShadow(TDEditor_TD, 0);
  76. return 1;
  77. }
  78.  
  79. public OnFilterScriptExit()
  80. {
  81. KillTimer(st);
  82. DestroyObject(MOVEBASE);
  83. DestroyObject(MOVEBASE+1);
  84. DestroyObject(MOVEBASE+2);
  85. DestroyObject(MOVEBASE+3);
  86. TextDrawDestroy(TDEditor_TD);
  87. return 1;
  88. }
  89.  
  90. new Float:X, Float:Y, Float:Z, Float:RZ;
  91. forward Update();
  92. public Update()
  93. {
  94.  
  95. GetObjectPos(MOVEBASE, X, Y, Z);
  96.  
  97. Y = Origin_X + (len * floatsin(angle, degrees));
  98. Z = Origin_Y + (len * floatcos(angle, degrees));
  99.  
  100. SetObjectPos(MOVEBASE, X, Y, Z);
  101. aAcc = (-0.005) * floatsin(angle, degrees);
  102. aVel += aAcc;
  103. angle += aVel;
  104. aVel *= damping;
  105. //printf("%f, %f", aAcc, aVel);
  106. RZ += 1.0;
  107.  
  108. SetObjectRot(MOVEBASE, -angle, 0.0, 0.0);
  109. EDIT_OBJECT_RotateZ(MOVEBASE, RZ); //This is for rotate bob, function from UOE by Stylock
  110. return 1;
  111. }
  112.  
  113.  
  114. public OnPlayerConnect(playerid)
  115. {
  116. TextDrawShowForPlayer(playerid, TDEditor_TD);
  117. UpdateTextDraw();
  118.  
  119. RemoveBuildingForPlayer(playerid, 1308, 9.0234, 15.1563, -5.7109, 0.25);
  120. RemoveBuildingForPlayer(playerid, 13056, -43.8984, 41.1094, 2.1094, 0.25);
  121. RemoveBuildingForPlayer(playerid, 3376, -15.5234, 68.4531, 6.6641, 0.25);
  122. RemoveBuildingForPlayer(playerid, 13413, -114.5781, -47.4063, 2.0234, 0.25);
  123. RemoveBuildingForPlayer(playerid, 13414, 50.1797, -43.2813, 0.9844, 0.25);
  124. RemoveBuildingForPlayer(playerid, 13049, -114.5781, -47.4063, 2.0234, 0.25);
  125. RemoveBuildingForPlayer(playerid, 13050, 50.1797, -43.2813, 0.9844, 0.25);
  126. RemoveBuildingForPlayer(playerid, 3276, -23.7344, 0.2656, 2.8906, 0.25);
  127. RemoveBuildingForPlayer(playerid, 3374, -50.0156, 3.1797, 3.4766, 0.25);
  128. RemoveBuildingForPlayer(playerid, 3276, -19.1953, 11.4688, 2.8906, 0.25);
  129. RemoveBuildingForPlayer(playerid, 3276, -10.9141, 15.3828, 2.8906, 0.25);
  130. RemoveBuildingForPlayer(playerid, 672, -35.7109, 18.1016, 3.4766, 0.25);
  131. RemoveBuildingForPlayer(playerid, 12919, -43.8984, 41.1094, 2.1094, 0.25);
  132. RemoveBuildingForPlayer(playerid, 3375, -15.5234, 68.4531, 6.6641, 0.25);
  133. return 1;
  134. }
  135.  
  136. CMD:go(playerid, params[])
  137. {
  138. st = SetTimer("Update", 10, 1);
  139. return 1;
  140. }
  141.  
  142. CMD:restart(playerid, params[])
  143. {
  144. KillTimer(st);
  145. aAcc = 0.0;
  146. aVel = aAcc;
  147. return 1;
  148. }
  149.  
  150. CMD:angle(playerid, params[])
  151. {
  152. if(sscanf(params, "f", angle)) return SendClientMessage(playerid, -1, "{996600}ERROR: /speed [Float: speed]");
  153. UpdateTextDraw();
  154.  
  155. Y = Origin_X + (len * floatsin(angle, degrees));
  156. Z = Origin_Y + (len * floatcos(angle, degrees));
  157.  
  158. SetObjectPos(MOVEBASE, X, Y, Z);
  159. SetObjectRot(MOVEBASE, -angle, 0.0, 0.0);
  160. return 1;
  161. }
  162.  
  163. CMD:damping(playerid, params[])
  164. {
  165. if(sscanf(params, "f", damping)) return SendClientMessage(playerid, -1, "{996600}ERROR: /damping [Float: damping]");
  166. UpdateTextDraw();
  167. return 1;
  168. }
  169.  
  170.  
  171. UpdateTextDraw()
  172. {
  173. new str[128];
  174. format(str, sizeof(str), "Lenght:_%.1f~n~Damping:_%.3f~n~Initial Angle:_%.1f", -len, damping, angle);
  175. TextDrawSetString(TDEditor_TD, str);
  176. }
  177.  
  178.  
  179.  
  180. //From Universal Object Editor by Stylock
  181. new
  182.  
  183. Float:g_Float1[3],
  184. Float:sx,
  185. Float:sy,
  186. Float:sz,
  187. Float:cx,
  188. Float:cy,
  189. Float:cz;
  190.  
  191.  
  192.  
  193. EDIT_OBJECT_RotateZ(oid, Float:rot_z)
  194. {
  195. EDIT_OBJECT_GetRot(oid, g_Float1);
  196. EDIT_ConvertValue(g_Float1[0], g_Float1[1], g_Float1[2]);
  197. EDIT_ConvertValue(asin(cx * cy), atan2(sx, cx * sy) + rot_z, atan2(cy * cz * sx - sy * sz, cz * sy - cy * sx * -sz));
  198. EDIT_OBJECT_SetRot(oid, asin(cx * sy), atan2(cx * cy, sx), atan2(cz * sx * sy - cy * sz, cy * cz + sx * sy * sz));
  199. return 1;
  200. }
  201.  
  202. EDIT_OBJECT_GetRot(oid, Float:rot[3])
  203. {
  204. if(IsValidObject(oid))
  205. {
  206. GetObjectRot(oid, rot[0], rot[1], rot[2]);
  207. EDIT_ModuloOperation(rot[0], rot[1], rot[2]);
  208. }
  209. return 1;
  210. }
  211.  
  212. EDIT_ConvertValue(Float:rot_x, Float:rot_y, Float:rot_z)
  213. {
  214. sx = floatsin(rot_x, degrees);
  215. sy = floatsin(rot_y, degrees);
  216. sz = floatsin(rot_z, degrees);
  217. cx = floatcos(rot_x, degrees);
  218. cy = floatcos(rot_y, degrees);
  219. cz = floatcos(rot_z, degrees);
  220. return 1;
  221. }
  222.  
  223. EDIT_ModuloOperation(&Float:rot_x, &Float:rot_y, &Float:rot_z)
  224. {
  225. EDIT_Remainder(rot_x, 360.0);
  226. EDIT_Remainder(rot_y, 360.0);
  227. EDIT_Remainder(rot_z, 360.0);
  228. return 1;
  229. }
  230.  
  231. EDIT_Remainder(&Float:remainder, Float:value)
  232. {
  233. if(remainder >= value)
  234. {
  235. while(remainder >= value)
  236. {
  237. remainder = remainder - value;
  238. }
  239. }
  240. else if(remainder < 0.0)
  241. {
  242. while(remainder < 0.0)
  243. {
  244. remainder = remainder + value;
  245. }
  246. }
  247. return 1;
  248. }
  249.  
  250. EDIT_OBJECT_SetRot(oid, Float:rX, Float:rY, Float:rZ)
  251. {
  252. SetObjectRot(oid, rX, rY, rZ);
  253. return 1;
  254. }
  255.  
  256. //Experimental FS by adri1
  257. //==============================================================================
Add Comment
Please, Sign In to add comment