Advertisement
Guest User

Jetpack fuel script by Jk.

a guest
Apr 25th, 2011
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.44 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Text:Full;
  4. new Text:Half;
  5. new Text:Jk;
  6. new Text:Low;
  7. new jetpack;
  8.  
  9. forward full(playerid);
  10. forward half(playerid);
  11. forward low(playerid);
  12. forward warning(playerid);
  13. forward out(playerid);
  14. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  15.  
  16.  
  17. public OnFilterScriptInit()
  18. {
  19. print("\n--------------------------------------");
  20. print(" Jet Script by Jaan_Kukin");
  21. print("--------------------------------------\n");
  22.  
  23. jetpack = CreatePickup(370, 2, 1519.2051,-1617.0542,13.5469, 0);
  24.  
  25. Full = TextDrawCreate(525.000000,162.000000,"Full");
  26. Half = TextDrawCreate(524.000000,185.000000,"half");
  27. Low = TextDrawCreate(524.000000,203.000000,"Low");
  28. Jk = TextDrawCreate(202.000000,435.000000,"Jk");
  29.  
  30. TextDrawAlignment(Jk,0);
  31. TextDrawBackgroundColor(Jk,0x000000ff);
  32. TextDrawFont(Jk,1);
  33. TextDrawLetterSize(Jk,1.000000,1.000000);
  34. TextDrawColor(Jk,0xffffffff);
  35. TextDrawSetOutline(Jk,1);
  36. TextDrawSetProportional(Jk,1);
  37. TextDrawSetShadow(Jk,1);
  38.  
  39. TextDrawUseBox(Full,1);
  40. TextDrawBoxColor(Full,0x00ff0033);
  41. TextDrawTextSize(Full,593.000000,43.000000);
  42. TextDrawUseBox(Half,1);
  43. TextDrawBoxColor(Half,0xffff0066);
  44. TextDrawTextSize(Half,594.000000,-1.000000);
  45. TextDrawUseBox(Low,1);
  46. TextDrawBoxColor(Low,0xff000066);
  47. TextDrawTextSize(Low,595.000000,-86.000000);
  48. TextDrawAlignment(Full,0);
  49. TextDrawAlignment(Half,0);
  50. TextDrawAlignment(Low,0);
  51. TextDrawBackgroundColor(Full,0x00ff0000);
  52. TextDrawBackgroundColor(Half,0x000000ff);
  53. TextDrawBackgroundColor(Low,0x000000ff);
  54. TextDrawFont(Full,1);
  55. TextDrawLetterSize(Full,1.200000,2.200000);
  56. TextDrawFont(Half,1);
  57. TextDrawLetterSize(Half,1.000000,1.600000);
  58. TextDrawFont(Low,3);
  59. TextDrawLetterSize(Low,1.100000,2.499999);
  60. TextDrawColor(Full,0xffff00ff);
  61. TextDrawColor(Half,0x00ffffcc);
  62. TextDrawColor(Low,0xff00ffff);
  63. TextDrawSetOutline(Full,1);
  64. TextDrawSetOutline(Half,1);
  65. TextDrawSetOutline(Low,1);
  66. TextDrawSetProportional(Full,1);
  67. TextDrawSetProportional(Half,1);
  68. TextDrawSetProportional(Low,1);
  69. TextDrawSetShadow(Full,1);
  70. TextDrawSetShadow(Half,1);
  71. TextDrawSetShadow(Low,1);
  72.  
  73. SetTimer("full",30000,false); // Set a timer of 1000 miliseconds (1 second)
  74. SetTimer("half",90000,false); // Set a timer of 1000 miliseconds (1 second)
  75. SetTimer("low",120000,false); // Set a timer of 1000 miliseconds (1 second)
  76. SetTimer("warning",160000,false); // Set a timer of 1000 miliseconds (1 second)
  77. SetTimer("out",170000,false); // Set a timer of 1000 miliseconds (1 second)
  78. return 1;
  79. }
  80.  
  81. public full(playerid)
  82. {
  83. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  84. {
  85. TextDrawHideForPlayer(playerid, Jk);
  86. TextDrawHideForPlayer(playerid, Low);
  87. TextDrawHideForPlayer(playerid, Half);
  88. TextDrawShowForPlayer(playerid, Full);
  89. }
  90. }
  91.  
  92. public half(playerid)
  93. {
  94. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  95. {
  96. TextDrawShowForPlayer(playerid, Half);
  97. TextDrawHideForPlayer(playerid, Full);
  98. }
  99. }
  100.  
  101. public low(playerid)
  102. {
  103. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  104. {
  105. TextDrawHideForPlayer(playerid, Half);
  106. TextDrawShowForPlayer(playerid, Low);
  107. }
  108. }
  109.  
  110. public warning(playerid)
  111. {
  112. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  113. {
  114. SendClientMessage(playerid, 0xFFFF00AA, "Your Jetpack is out of fuel in 10 second!");
  115. PlayerPlaySound(playerid, 1142, 0.0, 0.0, 10.0);
  116. }
  117. }
  118.  
  119. public out(playerid)
  120. {
  121. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  122. {
  123. TextDrawHideForPlayer(playerid, Low);
  124. ClearAnimations(playerid);
  125. GameTextForPlayer(playerid, "~w~Out of Fuel!", 5000, 1);
  126. PlayerPlaySound(playerid, 1144, 0.0, 0.0, 10.0);
  127. }
  128. }
  129.  
  130. public OnPlayerPickUpPickup(playerid, pickupid)
  131. {
  132. if(pickupid == jetpack) SendClientMessage(playerid, 0xFFFF00AA, "Your Jetpack is full of fuel!");
  133. return 1;
  134. }
  135.  
  136. public OnFilterScriptExit()
  137. {
  138. return 1;
  139. }
  140.  
  141. public OnPlayerDeath(playerid, killerid, reason)
  142. {
  143. TextDrawHideForPlayer(playerid, Low);
  144. TextDrawHideForPlayer(playerid, Half);
  145. TextDrawHideForPlayer(playerid, Full);
  146. return 1;
  147. }
  148.  
  149. public OnPlayerCommandText(playerid, cmdtext[])
  150. {
  151. if (strcmp("/filljet", cmdtext, true, 10) == 0)
  152. {
  153. if(PlayerToPoint(10.0,playerid,1938.8751,-1774.2018,13.3828) || PlayerToPoint(10.0,playerid,1944.3260,-1772.9254,13.3906))
  154. {
  155. if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
  156. {
  157. SetTimer("full",30000,false); // Set a timer of 1000 miliseconds (1 second)
  158. SendClientMessage(playerid, 0xFFFF00AA, "You filled your jetpack with fuel!");
  159. TextDrawHideForPlayer(playerid, Low);
  160. TextDrawHideForPlayer(playerid, Half);
  161. TextDrawShowForPlayer(playerid, Full);
  162. }
  163. else
  164. {
  165. SendClientMessage(playerid,0xC2A2DAAA," You're not at a Gas Station!");
  166. }
  167.  
  168. return 1;
  169.  
  170. }
  171. }
  172. return 0;
  173. }
  174.  
  175. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  176. {
  177. if(IsPlayerConnected(playerid))
  178. {
  179. RemovePlayerMapIcon(playerid, 0); //Map icon disable xD
  180. new Float:oldposx, Float:oldposy, Float:oldposz;
  181. new Float:tempposx, Float:tempposy, Float:tempposz;
  182. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  183. tempposx = (oldposx -x);
  184. tempposy = (oldposy -y);
  185. tempposz = (oldposz -z);
  186. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  187. {
  188. return 1;
  189. }
  190. }
  191. return 0;
  192. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement