Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.94 KB | None | 0 0
  1.  
  2. #include <a_samp>
  3. #include <sscanf2>
  4. #include <zcmd>
  5.  
  6. new execute = 1;
  7. new objects = 0;
  8. public OnPlayerCommandText(playerid, cmdtext[])
  9. {
  10.  
  11. if (strcmp("/select", cmdtext, true) == 0)
  12. {
  13. execute = 1;
  14. SelectObject(playerid);
  15. return 1;
  16. }
  17.  
  18. if (strcmp("/info", cmdtext, true) == 0)
  19. {
  20. execute = 0;
  21. SelectObject(playerid);
  22. return 1;
  23. }
  24.  
  25.  
  26. if (strcmp("/up", cmdtext, true) == 0)
  27. {
  28. new Float:PP[3];
  29. GetPlayerPos(playerid, PP[0], PP[1], PP[2]);
  30. SetPlayerPos(playerid, PP[0], PP[1], PP[2]+7.00);
  31. new veh = CreateVehicle(411, PP[0], PP[1], PP[2]+7.00, 0.00, 0, 0, 0);
  32. PutPlayerInVehicle(playerid, veh, 0);
  33. GivePlayerWeapon(playerid, 43, 10000);
  34. return 1;
  35. }
  36.  
  37. if (strcmp("/getpos", cmdtext, true) == 0)
  38. {
  39. new Float:PP[3];
  40. GetPlayerPos(playerid, PP[0], PP[1], PP[2]);
  41. new str[256];
  42.  
  43. format(str, sizeof str, "XYZ: %f.04, %f.04, %f.04", PP[0], PP[1], PP[2]);
  44. SendClientMessage(playerid, -1, str);
  45. return 1;
  46. }
  47.  
  48.  
  49. if (strcmp("/pos", cmdtext, true) == 0)
  50. {
  51.  
  52. SetPlayerPos(playerid, 0.00, 0.00, 10.00);
  53. return 1;
  54. }
  55.  
  56. if (strcmp("/test", cmdtext, true) == 0)
  57. {
  58. new Float:PP[3];
  59. GetPlayerPos(playerid, PP[0], PP[1], PP[2]);
  60. Generate_Island(PP[0], PP[1], PP[2]+5.00, 5,5);
  61. new str[128];
  62. format(str, 128, "%d", objects);
  63. SendClientMessage(playerid, -1, str);
  64. return 1;
  65. }
  66.  
  67. return 0;
  68. }
  69.  
  70. CMD:island(playerid, params[])
  71. {
  72. new w, h;
  73. if(sscanf(params, "ii", w, h)) SendClientMessage(playerid, -1, "USE: /island <W> <H>");
  74. else
  75. {
  76. new Float:PP[3];
  77. GetPlayerPos(playerid, PP[0], PP[1], PP[2]);
  78. SetPlayerPos(playerid, PP[0], PP[1], PP[2]+6.00);
  79. Generate_Island(PP[0], PP[1], PP[2]+5.00, w, h);
  80. new str[128];
  81. format(str, 128, "%d objects created. (%i*%i)", objects, w, h);
  82. SendClientMessage(playerid, -1, str);
  83. }
  84. return 1;
  85. }
  86.  
  87. CMD:car(playerid, params[])
  88. {
  89. new Float:PP[3];
  90. GetPlayerPos(playerid, PP[0], PP[1], PP[2]);
  91. new veh = CreateVehicle(447, PP[0], PP[1], PP[2]+7.00, 0.00, 0, 0, 0);
  92. PutPlayerInVehicle(playerid, veh, 0);
  93. return 1;
  94. }
  95.  
  96. CMD:tele(playerid, params[])
  97. {
  98. SetPlayerPos(playerid, -3343.57 + random(2), 194.34 + random(2), 6.2);
  99. SetPlayerFacingAngle(playerid, 315);
  100. SetCameraBehindPlayer(playerid);
  101. return 1;
  102. }
  103.  
  104. stock Upside_Plot(Float:X, Float:Y, Float:Z)
  105. {
  106. #define X_DIFF 70.0000
  107. #define Y_DIFF 70.0000
  108. CreateObject(19529, X, Y, Z, 0.00, 0.00, 90.00); // ALAP
  109. CreateObject(19532, X, ( Y + Y_DIFF ), Z, 0.00, 0.00, 90.00); //fennti út
  110. CreateObject(19532, X, ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //lennti út
  111. CreateObject(19532, ( X + X_DIFF ), Y, Z, 0.00, 0.00, 0.00); //jobb út
  112. CreateObject(19534, ( X + X_DIFF ), ( Y + Y_DIFF ), Z, 0.00, 0.00, 90.00); //sarok
  113. CreateObject(19534, ( X + X_DIFF ), ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //sarok
  114. objects += 6;
  115. return 1;
  116. }
  117.  
  118. stock Rightside_Plot(Float:X, Float:Y, Float:Z)
  119. {
  120. #define X_DIFF 70.0000
  121. #define Y_DIFF 70.0000
  122. CreateObject(19529, X, Y, Z, 0.00, 0.00, 90.00); // ALAP
  123. CreateObject(19532, X, ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //lennti út
  124. CreateObject(19532, ( X + X_DIFF ), Y, Z, 0.00, 0.00, 0.00); //jobb út
  125. CreateObject(19534, ( X + X_DIFF ), ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //sarok
  126. objects += 4;
  127. return 1;
  128. }
  129.  
  130. stock Leftside_Plot(Float:X, Float:Y, Float:Z)
  131. {
  132. #define X_DIFF 70.0000
  133. #define Y_DIFF 70.0000
  134. CreateObject(19529, X, Y, Z, 0.00, 0.00, 90.00); // ALAP
  135. CreateObject(19532, X, ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //alsó út
  136. CreateObject(19532, ( X - X_DIFF ), Y, Z, 0.00, 0.00, 0.00); //bal út
  137. CreateObject(19532, ( X + X_DIFF ), Y, Z, 0.00, 0.00, 0.00); //jobb út
  138. CreateObject(19534, ( X - X_DIFF ), ( Y - Y_DIFF ), Z, 0.00, 0.00, 270.00); //sarok
  139. CreateObject(19534, ( X + X_DIFF ), ( Y - Y_DIFF ), Z, 0.00, 0.00, 270.00); //sarok
  140. objects += 6;
  141. return 1;
  142. }
  143.  
  144. stock Leftside_Sarok_Plot(Float:X, Float:Y, Float:Z) //utolsó amit lerak
  145. {
  146. #define X_DIFF 70.0000
  147. #define Y_DIFF 70.0000
  148. CreateObject(19529, X, Y, Z, 0.00, 0.00, 90.00); // ALAP
  149. CreateObject(19532, X, ( Y + Y_DIFF ), Z, 0.00, 0.00, 90.00); //fennti út
  150. CreateObject(19532, X, ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //alsó út
  151. CreateObject(19532, ( X - X_DIFF ), Y, Z, 0.00, 0.00, 0.00); //jobb út
  152. CreateObject(19532, ( X + X_DIFF ), Y, Z, 0.00, 0.00, 0.00); //bal út
  153. CreateObject(19534, ( X - X_DIFF ), ( Y - Y_DIFF ), Z, 0.00, 0.00, 90.00); //keresztezodes jobbfennt
  154. CreateObject(19534, ( X - X_DIFF ), ( Y + Y_DIFF ), Z, 0.00, 0.00, 180.00); //sarok jobblent
  155. CreateObject(19534, ( X + X_DIFF ), ( Y + Y_DIFF ), Z, 0.00, 0.00, 180.00); //sarok ballent
  156. CreateObject(19534, ( X + X_DIFF ), ( Y - Y_DIFF ), Z, 0.00, 0.00, 270.00); //keresztezodes fent
  157. objects += 9;
  158. return 1;
  159. }
  160.  
  161. stock Coach_Large(Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
  162. {
  163. CreateObject(19539, X, Y, Z, rX, rY, rZ);
  164. objects++;
  165. return 1;
  166. }
  167.  
  168. stock Coach_Small(Float:X, Float:Y, Float:Z, Float:rX, Float:rY, Float:rZ)
  169. {
  170. CreateObject(19541, X, Y, Z, rX, rY, rZ);
  171. objects++;
  172. return 1;
  173. }
  174.  
  175. Generate_Island(Float:X, Float:Y, Float:Z, hossz=10, szelesseg=10)
  176. {
  177. #define PLOT_DIFF 140.0000
  178. #define SAND_DIFF 62.50
  179.  
  180. new Float:COUNT_X = 0.00, Float:COUNT_Y = 0.00;
  181.  
  182. // Telek, út, homok része
  183. for(new i = 0; i < hossz; i++)
  184. {
  185. if(i == (hossz-1))
  186. {
  187. Upside_Plot(X, floatadd(Y, COUNT_Y), Z);
  188. Leftside_Sarok_Plot( floatsub(X, floatmul(PLOT_DIFF, (szelesseg-1))), floatadd(Y, COUNT_Y), Z);
  189. }
  190. else
  191. {
  192. Rightside_Plot(X, floatadd(Y, COUNT_Y), Z);
  193. Leftside_Plot( floatsub(X, floatmul(PLOT_DIFF, (szelesseg-1))), floatadd(Y, COUNT_Y), Z);
  194. }
  195.  
  196. if(i == 0) // Két első szél
  197. {
  198. Coach_Small( floatadd(X, floatadd(X_DIFF, 7.50)), floatsub(floatadd(Y, COUNT_Y), floatdiv(PLOT_DIFF, 2)), Z, 0.00, 0.00, 0.00);
  199. Coach_Small( floatsub(floatsub(floatsub(X, floatmul(PLOT_DIFF, (szelesseg-1))), floatdiv(PLOT_DIFF, 2)), 7.50), floatsub(floatadd(Y, COUNT_Y), floatdiv(PLOT_DIFF, 2)) , Z, 0.00, 0.00, 180.00);
  200. }
  201. Coach_Large( floatadd(X, floatadd(X_DIFF, 7.50)), floatsub(floatadd(Y, COUNT_Y), floatdiv(SAND_DIFF, 2)), Z, 0.00, 0.00, 0.00);
  202. Coach_Large( floatadd(X, floatadd(X_DIFF, 7.50)), floatadd(floatadd(Y, COUNT_Y), floatdiv(SAND_DIFF, 2)), Z, 0.00, 0.00, 0.00);
  203. Coach_Small( floatadd(X, floatadd(X_DIFF, 7.50)), floatadd(floatadd(Y, COUNT_Y), floatdiv(PLOT_DIFF, 2)), Z, 0.00, 0.00, 0.00);
  204.  
  205. Coach_Large( floatsub( floatsub( floatsub(X, floatmul(PLOT_DIFF, (szelesseg-1))), floatdiv(PLOT_DIFF,2)),7.50), floatsub(floatadd(Y, COUNT_Y), floatdiv(SAND_DIFF, 2)), Z, 0.00, 0.00, 180.00);
  206. Coach_Large( floatsub( floatsub( floatsub(X, floatmul(PLOT_DIFF, (szelesseg-1))), floatdiv(PLOT_DIFF,2)),7.50), floatadd(floatadd(Y, COUNT_Y), floatdiv(SAND_DIFF, 2)), Z, 0.00, 0.00, 180.00);
  207. Coach_Small( floatsub( floatsub( floatsub(X, floatmul(PLOT_DIFF, (szelesseg-1))), floatdiv(PLOT_DIFF,2)),7.50), floatadd(floatadd(Y, COUNT_Y), floatdiv(PLOT_DIFF, 2)), Z, 0.00, 0.00, 180.00);
  208.  
  209. COUNT_X = 140.0000;
  210.  
  211. for(new a = 1; a < (szelesseg-1); a++)
  212. {
  213. if(i == (hossz-1))
  214. Upside_Plot(floatsub(X, COUNT_X), floatadd(Y, COUNT_Y), Z);
  215. else
  216. Rightside_Plot( floatsub(X, COUNT_X), floatadd(Y, COUNT_Y), Z);
  217.  
  218. COUNT_X += PLOT_DIFF;
  219. }
  220.  
  221. COUNT_Y += PLOT_DIFF;
  222.  
  223. }
  224.  
  225. return 1;
  226. }
  227.  
  228.  
  229. public OnPlayerSelectObject(playerid, type, objectid, modelid, Float:fX, Float:fY, Float:fZ)
  230. {
  231. if(execute == 1)
  232. {
  233. EditObject(playerid, objectid);
  234. }
  235. else
  236. {
  237. new str[256];
  238. new Float:rx, Float:ry, Float:rz;
  239. GetObjectRot( objectid, rx, ry, rz );
  240. format(str, sizeof str, "ID: %i, XYZ: %f.04, %f.04, %f.04, RXYZ: %f.04, %f.04, %f.04, MODELID: %i", objectid, fX, fY, fZ, rx, ry, rz, modelid);
  241. SendClientMessage(playerid, -1, str);
  242. }
  243. return 1;
  244. }
  245.  
  246. public OnFilterScriptInit()
  247. {
  248.  
  249. return 1;
  250. }
  251.  
  252. public OnFilterScriptExit()
  253. {
  254.  
  255. return 1;
  256. }
  257.  
  258. public OnPlayerConnect(playerid)
  259. {
  260.  
  261. return 1;
  262. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement