Advertisement
Guest User

Untitled

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