Advertisement
Guest User

Untitled

a guest
Jan 29th, 2011
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.40 KB | None | 0 0
  1. /**********************************************
  2. * |- FileScript Creato da Angelo & Mik_Tek *
  3. * |- Scripted by Angelo *
  4. * |- Mapped by Mik_Tek *
  5. **********************************************/
  6.  
  7. #include <a_samp>
  8.  
  9. new
  10. bool:InRampone[MAX_PLAYERS][2],
  11. Float:Punti[MAX_PLAYERS],
  12. Text:pText[MAX_PLAYERS],
  13. Float:Migliore,
  14. Float:Pos[3],
  15. string[32],
  16. stringa[128],
  17. Nome[MAX_PLAYERS][24],
  18. NomeMigliore[24],
  19. Float:vPos[3];
  20.  
  21. public OnFilterScriptInit()
  22. {
  23. //Veicoli
  24.  
  25. AddStaticVehicle(411,1455.0143,-2455.9749,374.0886,271.3305,-1,-1); //
  26. AddStaticVehicle(415,1454.5524,-2452.5510,374.1148,270.8788,-1,-1); //
  27. AddStaticVehicle(478,1454.9729,-2449.5723,374.3409,269.4789,-1,-1); //
  28. AddStaticVehicle(400,1454.0809,-2442.9893,374.4373,272.4163,-1,-1); //
  29. AddStaticVehicle(550,1454.5004,-2439.9741,374.1682,269.7943,-1,-1); //
  30. AddStaticVehicle(601,1454.4098,-2436.8069,374.1038,269.2843,-1,-1); //
  31. AddStaticVehicle(558,1454.6194,-2433.4028,373.9746,272.3688,-1,-1); //
  32. AddStaticVehicle(500,1453.7607,-2430.2820,374.4548,269.0540,-1,-1); //
  33. AddStaticVehicle(431,1434.2195,-2471.4351,374.4696,181.0037,-1,-1); // bus
  34. AddStaticVehicle(407,1433.8470,-2453.7258,374.6012,180.7773,-1,-1); // firetruck
  35. AddStaticVehicle(596,1435.4885,-2443.4033,374.0659,270.4857,-1,-1); // lspula
  36. AddStaticVehicle(596,1435.1592,-2440.4717,374.0659,270.1015,-1,-1); // lspula
  37. AddStaticVehicle(596,1435.1637,-2436.9319,374.0662,272.9802,-1,-1); // lspula
  38. AddStaticVehicle(596,1435.4213,-2433.9465,374.0653,270.3203,-1,-1); // lspula
  39. AddStaticVehicle(457,1434.4935,-2430.6777,373.9716,272.1332,-1,-1); // caddy
  40. AddStaticVehicle(457,1435.0248,-2427.6980,373.9717,270.7757,-1,-1); // caddy
  41. AddStaticVehicle(457,1435.2449,-2424.4780,373.9717,269.6982,-1,-1); // caddy
  42. AddStaticVehicle(434,1435.0844,-2421.0137,374.3116,269.3414,-1,-1); // hotknife
  43. AddStaticVehicle(434,1434.0487,-2417.8259,374.3123,271.1852,-1,-1); // hotknife
  44. AddStaticVehicle(434,1433.8861,-2414.7673,374.3231,268.7269,-1,-1); // hotknife
  45. AddStaticVehicle(571,1434.3413,-2411.5095,373.6363,270.5484,-1,-1); // kart
  46. AddStaticVehicle(571,1433.1329,-2408.5894,373.6364,272.2322,-1,-1); // kart
  47. AddStaticVehicle(571,1433.3000,-2404.9668,373.6364,269.5245,-1,-1); // kart
  48. AddStaticVehicle(571,1433.7128,-2401.1611,373.6306,272.7375,-1,-1); // kart
  49. AddStaticVehicle(522,1441.0708,-2401.1482,373.9238,178.2809,-1,-1); // nrg
  50. AddStaticVehicle(522,1443.9855,-2401.8674,373.9147,180.7868,-1,-1); // nrg
  51. AddStaticVehicle(522,1446.6422,-2401.8306,373.9173,181.5186,-1,-1); // nrg
  52. AddStaticVehicle(522,1449.8420,-2401.7820,373.9151,177.9504,-1,-1); // nrg
  53. AddStaticVehicle(490,1453.1544,-2402.1348,374.4848,181.0019,-1,-1); // nrg
  54. AddStaticVehicle(490,1456.9458,-2402.2375,374.4724,180.8197,-1,-1); // nrg
  55. AddStaticVehicle(601,1463.8644,-2404.0090,374.1116,90.4125,-1,-1); // swat
  56. AddStaticVehicle(601,1463.9260,-2407.5569,374.1140,91.6999,-1,-1); // swat
  57. AddStaticVehicle(521,1464.5978,-2411.3379,373.9165,91.1292,-1,-1); // fcr
  58. AddStaticVehicle(521,1465.7520,-2414.9604,373.9149,85.7099,-1,-1); // fcr
  59. AddStaticVehicle(521,1464.8241,-2417.5466,373.9149,86.3574,-1,-1); // fcr
  60. AddStaticVehicle(423,1464.9523,-2420.6619,374.3675,89.3044,-1,-1); // mr whoopee
  61. AddStaticVehicle(423,1465.1482,-2423.7839,374.3678,96.2799,-1,-1); // mr whoopee
  62. AddStaticVehicle(423,1465.2975,-2426.8069,374.3673,93.9276,-1,-1); // mr whoopee
  63. AddStaticVehicle(514,1466.8993,-2472.2603,374.9326,179.9683,-1,-1); // tanker
  64. AddStaticVehicle(514,1466.7557,-2460.4902,374.9422,180.4612,-1,-1); // tanker
  65. AddStaticVehicle(481,1465.4388,-2443.8643,373.8637,92.5690,-1,-1); // bmx
  66. AddStaticVehicle(481,1466.5782,-2441.8186,373.8609,88.1559,-1,-1); // bmx
  67. AddStaticVehicle(510,1465.0920,-2439.2129,373.9538,99.2693,-1,-1); // mountain bike
  68. AddStaticVehicle(510,1465.6185,-2433.8965,373.9526,87.1027,-1,-1); // mountain bike
  69.  
  70. //Oggetti
  71.  
  72. CreateObject(8040, 1450.0349121094, -2438.0561523438, 374.11053466797, 0, 0, 271);
  73. CreateObject(18450, 1451.1374511719, -2512.3166503906, 352.94769287109, 0, 330, 91.25);
  74. CreateObject(18450, 1452.6154785156, -2579.6813964844, 310.2223815918, 0, 325.24633789063, 91.246948242188);
  75. CreateObject(18450, 1453.8248291016, -2637.349609375, 256.19842529297, 0, 308.48962402344, 91.246948242188);
  76. CreateObject(18450, 1454.9030761719, -2686.9470214844, 193.77340698242, 0, 308.48510742188, 91.246948242188);
  77. CreateObject(18450, 1455.9645996094, -2736.5651855469, 131.36822509766, 0, 308.48510742188, 91.246948242188);
  78. CreateObject(1634, 1460.5615234375, -2762.8505859375, 100.33247375488, 310, 0, 180.25, 300.0);
  79. CreateObject(1634, 1456.4216308594, -2762.9111328125, 100.307472229, 309.99572753906, 0, 179.99450683594, 300.0);
  80. CreateObject(1634, 1452.8048095703, -2762.9030761719, 100.33247375488, 309.99572753906, 0, 180.49450683594, 300.0);
  81. CreateObject(1634, 1450.4832763672, -2762.9245605469, 100.33247375488, 309.99572753906, 0, 180.49438476563, 300.0);
  82. CreateObject(1634, 1462.7199707031, -2762.7822265625, 100.38247680664, 309.99572753906, 0, 180.24450683594, 300.0);
  83. CreateObject(1634, 1462.7497558594, -2770.1083984375, 98.682357788086, 331.24597167969, 0.28515625, 180.37889099121, 300.0);
  84. CreateObject(1634, 1458.5969238281, -2770.1450195313, 98.682357788086, 331.24328613281, 0.2801513671875, 180.37353515625, 300.0);
  85. CreateObject(1634, 1454.6889648438, -2770.1748046875, 98.657356262207, 331.24328613281, 0.2801513671875, 180.37353515625, 300.0);
  86. CreateObject(1634, 1450.5861816406, -2770.208984375, 98.632354736328, 331.24328613281, 0.2801513671875, 180.37353515625, 300.0);
  87. CreateObject(1634, 1454.6408691406, -2775.2841796875, 99.382400512695, 353.49304199219, 0.2471923828125, 180.26672363281, 300.0);
  88. CreateObject(1634, 1450.6087646484, -2775.3330078125, 99.357398986816, 353.49060058594, 0.2471923828125, 180.263671875, 300.0);
  89. CreateObject(1634, 1458.6645507813, -2775.259765625, 99.407402038574, 353.49060058594, 0.2471923828125, 180.263671875, 300.0);
  90. CreateObject(1634, 1462.8159179688, -2775.2158203125, 99.407402038574, 353.49060058594, 0.2471923828125, 180.263671875, 300.0);
  91. CreateObject(1634, 1450.7100830078, -2781.0866699219, 102.08247375488, 6.490478515625, 0.2471923828125, 180.20767211914, 300.0);
  92. CreateObject(1634, 1454.8597412109, -2781.0830078125, 102.08247375488, 6.4874267578125, 0.2471923828125, 180.20324707031, 300.0);
  93. CreateObject(1634, 1459.0109863281, -2781.0815429688, 102.10747528076, 6.4874267578125, 0.2471923828125, 179.95324707031, 300.0);
  94. CreateObject(1634, 1463.1115722656, -2781.1030273438, 102.10747528076, 6.48193359375, 0.2471923828125, 179.95056152344, 300.0);
  95. return 1;
  96. }
  97.  
  98. public OnFilterScriptExit()
  99. {
  100. return 1;
  101. }
  102.  
  103. public OnPlayerConnect(playerid)
  104. {
  105. pText[playerid] = TextDrawCreate(275.0, 180.0, "0.0");
  106. TextDrawFont(pText[playerid], 2);
  107. TextDrawSetShadow(pText[playerid], 1);
  108. TextDrawSetOutline(pText[playerid], 1);
  109. TextDrawBackgroundColor(pText[playerid], 0x0000FF);
  110. return 1;
  111. }
  112.  
  113. public OnPlayerCommandText(playerid, cmdtext[])
  114. {
  115. if(strcmp(cmdtext, "/exit", true)==0)
  116. {
  117. SpawnPlayer(playerid);
  118. InRampone[playerid][0] = false;
  119. InRampone[playerid][1] = false;
  120. return 1;
  121. }
  122.  
  123. if(strcmp(cmdtext, "/Migliore", true)==0)
  124. {
  125. new str[128];
  126. if(!strlen(NomeMigliore)) SendClientMessage(playerid, 0xFFFFFF, "Nessuno oggi ha ancora fatto un record al rampone");
  127. else
  128. {
  129. format(str, 128, "Il miglior punteggio al rampone รจ stato fatto da %s ed รจ di %0.3f", NomeMigliore, Migliore);
  130. SendClientMessage(playerid, 0xFFFFFF, str);
  131. }
  132. return 1;
  133. }
  134.  
  135. if(InRampone[playerid][0]) return SendClientMessage(playerid, 0xFFFFFF, "Non puoi usare comandi nel rampone, usa /exit per usare dal rampone");
  136.  
  137. if(strcmp(cmdtext, "/Rampone", true)==0)
  138. {
  139. InRampone[playerid][0] = true;
  140. SetPlayerPos(playerid, 1450.0349121094, -2438.0561523438, 375.11053466797);
  141. return 1;
  142. }
  143.  
  144. return 0;
  145. }
  146.  
  147. public OnPlayerDeath(playerid, killerid, reason)
  148. {
  149. if(InRampone[playerid][0])
  150. {
  151. InRampone[playerid][0] = false;
  152. InRampone[playerid][1] = false;
  153. }
  154. return 1;
  155. }
  156.  
  157. public OnPlayerStateChange(playerid, newstate, oldstate)
  158. {
  159. if(oldstate & PLAYER_STATE_DRIVER && newstate & PLAYER_STATE_ONFOOT && InRampone[playerid][1])
  160. {
  161. InRampone[playerid][1] = false;
  162. TextDrawHideForPlayer(playerid, pText[playerid]);
  163. Punti[playerid] = 0.0;
  164. SetPlayerHealth(playerid, 0.0);
  165. GameTextForPlayer(playerid, "~r~Record annullato, hai abbandonato il tuo veicolo!", 3500, 3);
  166. }
  167. return 1;
  168. }
  169.  
  170. public OnPlayerUpdate(playerid)
  171. {
  172. GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
  173.  
  174. if(InRampone[playerid][0] && GetPlayerState(playerid) == PLAYER_STATE_DRIVER && IsPlayerInArea(playerid, 1449.0952, -2783.5125, 1464.5142, -2760.8533, 102.1941, 105.6925))
  175. {
  176. InRampone[playerid][1] = true;
  177. TextDrawShowForPlayer(playerid, pText[playerid]);
  178. }
  179.  
  180. if(InRampone[playerid][1])
  181. {
  182. if(Punti[playerid] >= 0.0 && Punti[playerid] <= 250.0) format(string, 32, "~y~%0.3f", Punti[playerid]);
  183. if(Punti[playerid] >= 250.0 && Punti[playerid] <= 500.0) format(string, 32, "~b~%0.3f", Punti[playerid]);
  184. if(Punti[playerid] >= 500.0 && Punti[playerid] <= 1000.0) format(string, 32, "~g~%0.3f", Punti[playerid]);
  185. if(Punti[playerid] >= 1000.0) format(string, 32, "~r~%0.3f", Punti[playerid]);
  186. TextDrawSetString(pText[playerid], string);
  187. GetVehiclePos(GetPlayerVehicleID(playerid), vPos[0], vPos[1], vPos[2]);
  188. Punti[playerid] = floatsqroot(floatpower(floatsub(1456.7112, vPos[0]), 2) + floatpower(floatsub(-2783.3083, vPos[1]), 2));
  189. if(Pos[2] <= 0.0)
  190. {
  191. SetTimerEx("Fine", 1000, false, "d", playerid);
  192. GetPlayerName(playerid, Nome[playerid], 24);
  193. SetPlayerPosEx(playerid, 1576.5568,-2636.7063,13.5469, 0.0, 0);
  194. InRampone[playerid][1] = false;
  195. }
  196. }
  197.  
  198. if(Pos[2] < 0.0 && InRampone[playerid][0] && !InRampone[playerid][1])
  199. {
  200. SetPlayerPosEx(playerid, 1576.5568,-2636.7063,13.5469, 0.0, 0);
  201. InRampone[playerid][0] = false;
  202. }
  203. return 1;
  204. }
  205.  
  206. forward Fine(playerid);
  207. public Fine(playerid)
  208. {
  209. if(Punti[playerid] > Migliore)
  210. {
  211. Migliore = Punti[playerid];
  212. format(stringa, 128, "Il Player %s ha totalizzato %0.3f Punti al rampone (Miglior punteggio di oggi)", Nome[playerid], Migliore);
  213. NomeMigliore = Nome[playerid];
  214. }
  215. else format(stringa, 128, "Il Player %s ha totalizzato %0.3f Punti al rampone", Nome[playerid], Punti[playerid]);
  216.  
  217. SendClientMessageToAll(0xFFFF00AA, stringa);
  218. TextDrawHideForPlayer(playerid, pText[playerid]);
  219. Punti[playerid] = 0.0;
  220. InRampone[playerid][0] = false;
  221. return 1;
  222. }
  223.  
  224. IsPlayerInArea(playerID, Float:minx, Float:miny, Float:maxx, Float:maxy, Float:minz, Float:maxz)
  225. {
  226. new Float:x, Float:y, Float:z; GetPlayerPos(playerID, x, y, z);
  227. return(x >= minx && x <= maxx && y >= miny && y <= maxy && z >=minz && z <= maxz);
  228. }
  229.  
  230. SetPlayerPosEx(playerid, Float:x, Float:y, Float:z, Float:angle, Interior)
  231. {
  232. if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
  233. {
  234. SetPlayerPos(playerid, x, y, z);
  235. SetPlayerFacingAngle(playerid, angle);
  236. }
  237. else
  238. {
  239. new vehicleid = GetPlayerVehicleID(playerid);
  240. SetVehiclePos(vehicleid, x, y, z);
  241. SetVehicleZAngle(vehicleid, angle);
  242. LinkVehicleToInterior(vehicleid, Interior);
  243. SetPlayerPos(playerid, x, y, z);
  244. SetPlayerFacingAngle(playerid, angle);
  245. SetPlayerInterior(playerid, Interior);
  246. PutPlayerInVehicle(playerid, vehicleid, 0);
  247. }
  248. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement