Advertisement
Guest User

Bert

a guest
Sep 2nd, 2008
1,008
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.96 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. // Mod by Bert so it works in a car!
  4.  
  5. #define MAX_PICKUPS 9
  6.  
  7. new PickUps;
  8. new BurgerPickUp[MAX_PICKUPS];
  9. new ChickenPickUp[MAX_PICKUPS];
  10.  
  11. new Menu:BurgerShot;
  12. new Menu:CluckinBell;
  13.  
  14. new IsMenuShowed[MAX_PLAYERS] = 0;
  15.  
  16. new Float:BurgerDriveIn[6][3] = {
  17. {801.5522, -1628.91, 13.3828},
  18. {1209.958,-896.7405, 42.9259},
  19. {-2341.86, 1021.184, 50.6953},
  20. {2485.291, 2022.611, 10.8203},
  21. {1859.496, 2084.797, 10.8203},
  22. {-2349.49, -152.182, 35.3203}
  23. };
  24.  
  25. new Float:ChickenDriveIn[3][3] = {
  26. {2409.651, -1488.65, 23.8281},
  27. {2377.733, -1909.27, 13.3828},
  28. {2375.014, 2021.186, 10.8203}
  29. };
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33. SendClientMessage(playerid, 0xFFFFFFAA, " This server is using 'Happy Meal' - More Informations: www.SA-Script-Crew.de.tf");
  34. SendClientMessage(playerid, 0xAA3333AA, "_____________________________________________________________________________________");
  35. return 1;
  36. }
  37.  
  38. public OnFilterScriptInit()
  39. {
  40. print("\n--------------------------------------");
  41. print(" Happy Meal 1.0 - SA Script Crew");
  42. print("--------------------------------------\n");
  43. SetTimer("UpdateBurgerPositions", 500, 1);
  44. SetTimer("UpdateChickenPositions", 500, 1);
  45. for(new i = 0; i < sizeof(BurgerDriveIn); i++)
  46. {
  47. BurgerPickUp[i] = CreatePickup(1239, 23, BurgerDriveIn[i][0], BurgerDriveIn[i][1], BurgerDriveIn[i][2]);
  48. PickUps++;
  49. }
  50. for(new i = 0; i < sizeof(ChickenDriveIn); i++)
  51. {
  52. ChickenPickUp[i] = CreatePickup(1239, 23, ChickenDriveIn[i][0], ChickenDriveIn[i][1], ChickenDriveIn[i][2]);
  53. PickUps++;
  54. }
  55. printf("Loading %d Pickups .... Successful!", PickUps);
  56. return 1;
  57. }
  58.  
  59. forward UpdateBurgerPositions();
  60. public UpdateBurgerPositions()
  61. {
  62. for(new i = 0; i < MAX_PLAYERS; i ++)
  63. {
  64. if(IsMenuShowed[i] == 0)
  65. {
  66. for(new j = 0; j < sizeof(BurgerDriveIn); j ++)
  67. {
  68. new Float:dist;
  69. dist = GetDistance(i, BurgerDriveIn[j][0], BurgerDriveIn[j][1]);
  70. if(dist < 5)
  71. {
  72. GameTextForPlayer(i, "~n~~n~~n~~w~Welcome to the ~r~Burger King~w~, please select your meal", 2000, 3);
  73. TogglePlayerControllable(i, 0);
  74. SetTimerEx("ShowMenuBurger", 2000, 0, "i", i);
  75. }
  76. }
  77. }
  78. }
  79. }
  80.  
  81. forward ShowMenuBurger(i);
  82. public ShowMenuBurger(i)
  83. {
  84. BurgerShot = CreateMenu("Burger Shot", 2, 125, 150, 300);
  85. AddMenuItem(BurgerShot, 0, "Baby Burger");
  86. AddMenuItem(BurgerShot, 1, "$5");
  87. AddMenuItem(BurgerShot, 0, "Double Cheese");
  88. AddMenuItem(BurgerShot, 1, "$10");
  89. AddMenuItem(BurgerShot, 0, "Triple Whopper");
  90. AddMenuItem(BurgerShot, 1, "$20");
  91. ShowMenuForPlayer(BurgerShot, i);
  92. IsMenuShowed[i] = 1;
  93. }
  94.  
  95. forward UpdateChickenPositions();
  96. public UpdateChickenPositions()
  97. {
  98. for(new i = 0; i < MAX_PLAYERS; i ++)
  99. {
  100. if(IsMenuShowed[i] == 0)
  101. {
  102. for(new j = 0; j < sizeof(ChickenDriveIn); j ++)
  103. {
  104. new Float:dist;
  105. dist = GetDistance(i, ChickenDriveIn[j][0], ChickenDriveIn[j][1]);
  106. if(dist < 5)
  107. {
  108. GameTextForPlayer(i, "~n~~n~~n~~w~Welcome to the ~r~Cluckin' Bell~w~, please select your meal", 2000, 3);
  109. TogglePlayerControllable(i, 0);
  110. SetTimerEx("ShowMenuChicken", 2000, 0, "i", i);
  111. }
  112. }
  113. }
  114. }
  115. }
  116.  
  117. forward ShowMenuChicken(i);
  118. public ShowMenuChicken(i)
  119. {
  120. CluckinBell = CreateMenu("Cluckin' Bell", 2, 125, 150, 300);
  121. AddMenuItem(CluckinBell, 0, "Chicken Nuggets");
  122. AddMenuItem(CluckinBell, 1, "$5");
  123. AddMenuItem(CluckinBell, 0, "Chicken Wing");
  124. AddMenuItem(CluckinBell, 1, "$10");
  125. AddMenuItem(CluckinBell, 0, "Crisp Chicken");
  126. AddMenuItem(CluckinBell, 1, "$20");
  127. ShowMenuForPlayer(CluckinBell, i);
  128. IsMenuShowed[i] = 1;
  129. }
  130.  
  131. public OnPlayerSelectedMenuRow(playerid, row)
  132. {
  133. new Menu:Current = GetPlayerMenu(playerid);
  134. new Float:PlayerHealth;
  135. new Health = GetPlayerHealth(playerid, PlayerHealth);
  136. if(Current == BurgerShot)
  137. {
  138. switch(row)
  139. {
  140. case 0:
  141. {
  142. GivePlayerMoney(playerid, -5);
  143. if(Health <= 74.9)
  144. {
  145. SetPlayerHealth(playerid, PlayerHealth+25);
  146. }
  147. else
  148. {
  149. SetPlayerHealth(playerid, 100.0);
  150. }
  151. SendClientMessage(playerid, 0xFFC801C8, "Burger Shot: Thank you for buying the Baby Burger, have a nice meal and good afternoon!");
  152. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  153. TogglePlayerControllable(playerid, 1);
  154. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  155. return 1;
  156. }
  157. case 1:
  158. {
  159. GivePlayerMoney(playerid, -10);
  160. if(Health <= 49.9)
  161. {
  162. SetPlayerHealth(playerid, PlayerHealth+50);
  163. }
  164. else
  165. {
  166. SetPlayerHealth(playerid, 100.0);
  167. }
  168. SendClientMessage(playerid, 0xFFC801C8, "Burger Shot: Thank you for buying the Double Cheese, have a Cheesy meal and good afternoon!");
  169. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  170. TogglePlayerControllable(playerid, 1);
  171. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  172. return 1;
  173. }
  174. case 2:
  175. {
  176. GivePlayerMoney(playerid, -20);
  177. SetPlayerHealth(playerid, PlayerHealth+100);
  178. SendClientMessage(playerid, 0xFFC801C8, "Burger Shot: Thank you for buying the Tripple Whopper, have a nice feast and good afternoon!");
  179. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  180. TogglePlayerControllable(playerid, 1);
  181. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  182. return 1;
  183. }
  184. }
  185. }
  186. if(Current == CluckinBell)
  187. {
  188. switch(row)
  189. {
  190. case 0:
  191. {
  192. GivePlayerMoney(playerid, -5);
  193. if(Health <= 74.9)
  194. {
  195. SetPlayerHealth(playerid, PlayerHealth+25);
  196. }
  197. else
  198. {
  199. SetPlayerHealth(playerid, 100.0);
  200. }
  201. SendClientMessage(playerid, 0xFFC801C8, "Cluckin' Bell: Thank you for your interest in our food, good afternoon!");
  202. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  203. TogglePlayerControllable(playerid, 1);
  204. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  205. return 1;
  206. }
  207. case 1:
  208. {
  209. GivePlayerMoney(playerid, -10);
  210. if(Health <= 49.9)
  211. {
  212. SetPlayerHealth(playerid, PlayerHealth+50);
  213. }
  214. else
  215. {
  216. SetPlayerHealth(playerid, 100.0);
  217. }
  218. SendClientMessage(playerid, 0xFFC801C8, "Cluckin' Bell: we thank you and hope you enjoy your Chicken Wing, have a good day!");
  219. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  220. TogglePlayerControllable(playerid, 1);
  221. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  222. return 1;
  223. }
  224. case 2:
  225. {
  226. GivePlayerMoney(playerid, -20);
  227. SetPlayerHealth(playerid, PlayerHealth+100);
  228. SendClientMessage(playerid, 0xFFC801C8, "Cluckin' Bell: We hope you eat it all, have a nice day!");
  229. PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
  230. TogglePlayerControllable(playerid, 1);
  231. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  232. return 1;
  233. }
  234. }
  235. }
  236. return 1;
  237. }
  238.  
  239. public OnPlayerExitedMenu(playerid)
  240. {
  241. TogglePlayerControllable(playerid, 1);
  242. SetTimerEx("CanDriveThruAgain", 7000, 0, "i", playerid);
  243. return 1;
  244. }
  245.  
  246. forward CanDriveThruAgain(playerid);
  247. public CanDriveThruAgain(playerid)
  248. {
  249. IsMenuShowed[playerid] = 0;
  250. }
  251.  
  252. forward Float:GetDistance(playerid, Float:x, Float:y);
  253. public Float:GetDistance(playerid, Float:x, Float:y)
  254. {
  255. new Float:x2, Float:y2, Float:z2;
  256. GetPlayerPos(playerid, x2, y2, z2);
  257. x = x - x2;
  258. y = y - y2;
  259. return floatsqroot(x*x+y*y);
  260. }
  261.  
  262. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  263. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  264. {
  265. new Float:oldposx, Float:oldposy, Float:oldposz;
  266. new Float:tempposx, Float:tempposy, Float:tempposz;
  267. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  268. tempposx = (oldposx -x);
  269. tempposy = (oldposy -y);
  270. tempposz = (oldposz -z);
  271. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  272. {
  273. return 1;
  274. }
  275. return 0;
  276. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement