Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.33 KB | None | 0 0
  1. #include <a_samp>
  2. #include <streamer>
  3. #include <foreach>
  4. new bountyiable[MAX_PLAYERS];
  5. new bountycash[MAX_PLAYERS];
  6. new inpubg[MAX_PLAYERS];
  7. new pubgsignedup[MAX_PLAYERS];
  8. new shootedtime[MAX_PLAYERS];
  9. new abiltopick[MAX_PLAYERS];
  10. CMD:bounty(playerid, params[])
  11. {
  12. new msg[136], bountyid, bountycashh;
  13. if(sscanf(params, "ii", bountyid, bountycashh)) return SendClientMessage(playerid, ERRORCOLOR, "Usage:/bounty [id] [amount]");
  14. if(!IsPlayerConnected(bountyid)) return SendClientMessage(playerid, ERRORCOLOR, "Invalid playerid");
  15. if(GetPlayerMoney(playerid) < bountycashh || GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid, ERRORCOLOR, "invaild amount");
  16. SetPlayerMoney(playerid, GetPlayerMoney(playerid) - bountycashh);
  17. bountiable[bountyid] = 1;
  18. bountycash[bountyid] = bountycashh;
  19. format(msg, sizeof(msg), "%s has set a bounty $%d on %s's head", Name[playerid] ,bountycashh, Name[bountyid]);
  20. SendClientMessageToAll(ERRORCOLOR, msg);
  21. return 1;
  22. }
  23. CMD:pubg(playerid, params[])
  24. {
  25. new pubgid, msg[123];
  26. if (CommandCheck(playerid, "pubg")) return 0;
  27. if (sscanf(params, "i", pubgid)) return SendClientMessage(playerid, ERRORCOLOR, "Usage: /pubg [1-4]");
  28. if (pubgid < 1 || pubgid > 4) return SendClientMessage(playerid, ERRORCOLOR, "invaild pubg name");
  29. if (inpubg[playerid] == 1) return SendClientMessage(playerid, ERRORCOLOR, "You are already in pubg");
  30. if (pubgsignedup[playerid] == 1) return SendClientMessage(playerid, ERRORCOLOR, "You have already signed up");
  31. if (pubg1running == 1) return SendClientMessage(playerid, ERRORCOLOR, "pubg 1 is already running , please wait a little.");
  32. if (pubgid == 1 && timerrunning == 0)
  33. {
  34. SetTimer("pubgpreperation", 12000, false);
  35. printf("pass 1");
  36. pubgsignedup[playerid] = 1;
  37. pubgplayers += 1;
  38. SendClientMessageToAll(0x91FF00FF, "Pubg 1 starts in 20 seconds , use {FF0000}(/pubg 1){91FF00} to join");
  39. format(msg, sizeof(msg), "{D4B790}%s has signed up for pubg 1. {FF0000}(/pubg 1)", Name[playerid]);
  40. SendClientMessageToAll(-1, msg);
  41. timerrunning = 1;
  42. }
  43. else if (pubgid == 1 && timerrunning == 1)
  44. {
  45. pubgsignedup[playerid] = 1;
  46. pubgplayers += 1;
  47. format(msg, sizeof(msg), "{D4B790}%s has signed up for pubg 1. {FF0000}(/pubg 1)", Name[playerid]);
  48. SendClientMessageToAll(-1, msg);
  49. }
  50. else if (pubgid == 2 || pubgid == 3 || pubgid == 4) return SendClientMessage(playerid, ERRORCOLOR, "The pubg id you had chosen is currently under maintance , please try again later");
  51. return 1;
  52. }
  53. CMD:pickup(playerid, params[])
  54. {
  55. if (inpubg[playerid] != 1) return SendClientMessage(playerid, ERRORCOLOR, "You may only use this command while in a game");
  56. if (abiltopick[playerid] == 0) return SendClientMessage(playerid, ERRORCOLOR, "Please wait 20 seconds before picking up the next weapon");
  57. if (IsPlayerInRangeOfPoint(playerid, 3,-992.2407,-1062.1375,129.2188))
  58. {
  59. GivePlayerWeapon(playerid, 23, 120);
  60. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  61. abiltopick[playerid] = 0;
  62. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  63. }
  64. else if (IsPlayerInRangeOfPoint(playerid, 3,-1049.3972,-1244.6392,128.4763))
  65. {
  66. GivePlayerWeapon(playerid, 9, 1);
  67. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  68. abiltopick[playerid] = 0;
  69. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  70. }
  71. else if (IsPlayerInRangeOfPoint(playerid, 3,-1161.2699,-1278.1047,154.5398))
  72. {
  73. GivePlayerWeapon(playerid, 34, 20);
  74. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  75. abiltopick[playerid] = 0;
  76. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  77. }
  78. else if (IsPlayerInRangeOfPoint(playerid, 3,-964.2363,-970.6340,131.9541))
  79. {
  80. GivePlayerWeapon(playerid, 27, 450);
  81. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  82. abiltopick[playerid] = 0;
  83. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  84. }
  85. else if (IsPlayerInRangeOfPoint(playerid, 3,-1172.9540,-985.1346,131.5091))
  86. {
  87. GivePlayerWeapon(playerid, 33, 35);
  88. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  89. abiltopick[playerid] = 0;
  90. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  91. }
  92. else if (IsPlayerInRangeOfPoint(playerid, 3,-1131.6649,-1084.4207,129.2188))
  93. {
  94. GivePlayerWeapon(playerid, 25, 100);
  95. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  96. abiltopick[playerid] = 0;
  97. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  98. }
  99. else if (IsPlayerInRangeOfPoint(playerid, 3,-994.1649,-1112.0087,132.2200))
  100. {
  101. GivePlayerWeapon(playerid, 31, 200);
  102. ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
  103. abiltopick[playerid] = 0;
  104. SetTimerEx("pickupcooldown", 20000, false , "i", playerid);
  105. }
  106. else return SendClientMessage(playerid, ERRORCOLOR, "You are not in range of any pickable item");
  107. return 1;
  108. }
  109. forward pickupcooldown(playerid);
  110. public pickupcooldown(playerid)
  111. {
  112. abiltopick[playerid] = 1;
  113. }
  114. CMD:pubgcancel(playerid, params[])
  115. {
  116. new msg[121];
  117. if (pubgsignedup[playerid] != 1) return SendClientMessage(playerid, ERRORCOLOR, "You didn't signedup to any pubg game yet");
  118. else
  119. {
  120. pubgplayers -= 1;
  121. pubgsignedup[playerid] = 0;
  122. format(msg, sizeof(msg), "{D4B790}%s has canceled sign'ion for pubg 1.{D4B790}", Name[playerid]);
  123. SendClientMessageToAll(-1, msg);
  124. }
  125. return 1;
  126. }
  127. forward pubgpreperation();
  128. public pubgpreperation()
  129. {
  130. new ppubg1start;
  131. ppubg1start = SetTimer("pubgstartup", 18000, false);
  132. if(pubgplayers < 2)
  133. {
  134. SendClientMessageToAll(ERRORCOLOR, "Pubg 1 had been canceled due to less players , 3 players required");
  135. KillTimer(ppubg1start);
  136. timerrunning = 0;
  137. pubgplayers = 0;
  138. foreach (new i : Character)
  139. {
  140. if(pubgsignedup[i] == 1)
  141. {
  142. pubgsignedup[i] = 0;
  143. }
  144. else if(inpubg[i] == 1)
  145. {
  146. inpubg[i] = 0;
  147. }
  148. }
  149. }
  150. printf("pass 2");
  151. return 1;
  152. }
  153. forward pubgstartup();
  154. public pubgstartup()
  155. {
  156. new Random;
  157. foreach(new i : Character)
  158. {
  159. if(pubgsignedup[i] == 1 && !IsPlayerNPC(i))
  160. {
  161. posstate_{i} = 12;
  162. Random = random(sizeof(pubg));
  163. SetPlayerPos(i, pubg[Random][0], pubg[Random][1], pubg[Random][2]);
  164. SetPlayerFacingAngle(i, pubg[Random][3]);
  165. SetPlayerVirtualWorld(i, 12);
  166. pubg1running = 1;
  167. pubgsignedup[i] = 0;
  168. ResetPlayerWeapons(i);
  169. SetPlayerArmour(i, 0);
  170. SetPlayerHealth(i, 70);
  171. GivePlayerWeapon(i, 25, 7);
  172. GivePlayerWeapon(i, 6, 1);
  173. SendClientMessage(i, 0xFF2121FF, "Note: c-bug is disabled while in a game!.");
  174. inpubg[i] = 1;
  175. abiltopick[i] = 1;
  176. SendClientMessage(i, 0x00B0EBFF, "{FF0000}Pubg 1: {00B0EB} You are now in a forest !, you have to survive to be the winner!");
  177. SendClientMessage(i, 0x00B0EBFF, "{FF0000}Pubg 1: {00B0EB} There is some pickups around the map , pickup them to help you !");
  178. SendClientMessage(i, 0x00B0EBFF, "{FF0000}Pubg 1: {00B0EB} Good luck hunter !");
  179. TogglePlayerControllable(i, 0);
  180. timerrunning = 0;
  181. counter = 6;
  182. printf("pubg startup : %d" , i);
  183. }
  184. }
  185. return 1;
  186. }
  187. public OnPlayerDeath(playerid, killerid, reason)
  188. {
  189. if(reason != 49 || reason != 50 || reason != 51 || reason != 0)
  190. {
  191. if(bountiable[playerid] == 1 && posstate_{playerid} == 0 && bountycash[playerid] != 0)
  192. {
  193. bountiable[playerid] = 0;
  194. GivePlayerMoney(killerid, bountycash[playerid]);
  195. format(msg, sizeof(msg), "%s has killed %s and taken %d", Name[killerid], Name[playerid], bountycash[playerid]);
  196. SendClientMessageToAll(ERRORCOLOR, msg);
  197. bountycash[playerid] = 0;
  198. }
  199. }
  200. if (inpubg[playerid] == 1 || pubgsignedup[playerid] == 1 && pubg1running == 1)
  201. {
  202. if(inpubg[playerid] == 1 && !IsPlayerNPC(playerid))
  203. {
  204. format(str, sizeof(str),"{FF0000}%s has been eleminated", Name[playerid]);
  205. SendClientMessageToAll(ERRORCOLOR,str);
  206. posstate_{playerid} = 0;
  207. SpawnPlayer(playerid);
  208. pubgplayers -= 1;
  209. inpubg[playerid] = 0;
  210. }
  211. if(pubgsignedup[playerid] == 1)
  212. {
  213. format(str, sizeof(str),"%s had been kicked out of the pubg 1 due to death of player.", Name[playerid]);
  214. SendClientMessageToAll(0xFFBF00FF,str);
  215. pubgplayers -= 1;
  216. inpubg[playerid] = 0;
  217. }
  218. if(pubgplayers == 0 && pubg1running == 1)
  219. {
  220. SendClientMessageToAll(ERRORCOLOR, "Pubg 1 had been canceled due to unknown reason");
  221. pubg1running = 0;
  222. pubgplayers = 0;
  223. }
  224. if(pubgplayers == 1)
  225. {
  226. foreach(new i : Character)
  227. {
  228. if(inpubg[i] == 1)
  229. {
  230. format(str, sizeof(str),"{FF0000}%s {00FF51}had won pubg 1 game",Name[i]);
  231. SendClientMessageToAll(ERRORCOLOR,str);
  232. posstate_{i} = 0;
  233. pubg1running = 0;
  234. pubgplayers = 0;
  235. SpawnPlayer(i);
  236. inpubg[i] = 0;
  237. }
  238. }
  239. }
  240. }
  241. return 1;
  242. }
  243. public OnPlayerDisconnect(playerid, reason)
  244. {
  245. if (inpubg[playerid] == 1)
  246. {
  247. if(inpubg[playerid] == 1)
  248. {
  249. format(str, sizeof(str),"{FF0000}%s has been eleminated", Name[playerid]);
  250. SendClientMessageToAll(ERRORCOLOR,str);
  251. pubgplayers -= 1;
  252. inpubg[playerid] = 0;
  253. }
  254. if(pubgplayers == 1)
  255. {
  256. foreach(new i : Character)
  257. {
  258. if(inpubg[i] == 1)
  259. {
  260. format(str, sizeof(str),"{FF0000}%s {00FF51}had won pubg 1 game",Name[i]);
  261. SendClientMessageToAll(ERRORCOLOR,str);
  262. pubg1running = 0;
  263. pubgplayers = 0;
  264. }
  265. }
  266. }
  267. }
  268. else if(pubgsignedup[playerid] == 1)
  269. {
  270. pubgsignedup[playerid] = 0;
  271. }
  272. return 1;
  273. }
  274. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  275. {
  276. if(inpubg[playerid] == 1 && gettime() - shootedtime[playerid] < 1 && (newkeys & KEY_CROUCH))
  277. {
  278. new Float:health;
  279. SendClientMessage(playerid, ERRORCOLOR, "c-bug is not allowed while in game ! , please do not abuse, - 7 hp taken !.");
  280. ClearAnimations(playerid);
  281. TogglePlayerControllable(playerid, 0);
  282. SetTimerEx("unfreeze", 2000, false, "i", playerid);
  283. GetPlayerHealth(playerid, health);
  284. SetPlayerHealth(playerid, health-7);
  285. }
  286. return 1;
  287. }
  288. forward OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ);
  289. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  290. {
  291. shootedtime[playerid] = gettime();
  292. return 1;
  293. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement