SecretBoss

Untitled

Dec 27th, 2015
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.92 KB | None | 0 0
  1. public OnPlayerDeath(playerid, killerid, reason)
  2. {
  3. Server(playerid, "OnPlayerDeathCalled");
  4.  
  5. playerData[playerid][hasSpawned] = false;
  6. playerData[playerid][ctpImmune] = true;
  7. playerData[playerid][abImmune] = true;
  8.  
  9. Server(playerid, "Booleans loaded");
  10.  
  11. // Easter
  12. PlayerTextDrawHide(playerid, playerData[playerid][Eggs][0]);
  13. PlayerTextDrawHide(playerid, playerData[playerid][Eggs][1]);
  14. PlayerTextDrawHide(playerid, playerData[playerid][Eggs][2]);
  15.  
  16. Server(playerid, "easter tds hidden");
  17.  
  18. if (playerData[playerid][isInDM])
  19. {
  20. Server(playerid, "player detected in dm");
  21. playerData[playerid][hasSpawned] = false;
  22. playerData[playerid][suicide] = false;
  23.  
  24. if (killerid != INVALID_PLAYER_ID)
  25. {
  26. playerData[killerid][dmKills]++;
  27. playerData[killerid][dmStreak]++;
  28. dmStats(killerid);
  29.  
  30. new randDeath = random(21), randomDeath[200];
  31. switch(randDeath)
  32. {
  33. case 0:
  34. {
  35. format(randomDeath, sizeof(randomDeath), "eliminated");
  36. }
  37. case 1:
  38. {
  39. format(randomDeath, sizeof(randomDeath), "fucked up");
  40. }
  41. case 2:
  42. {
  43. format(randomDeath, sizeof(randomDeath), "raped");
  44. }
  45. case 3:
  46. {
  47. format(randomDeath, sizeof(randomDeath), "put some lead into");
  48. }
  49. case 4:
  50. {
  51. format(randomDeath, sizeof(randomDeath), "gave a lead tattoo to");
  52. }
  53. case 5:
  54. {
  55. format(randomDeath, sizeof(randomDeath), "delivered some bullets to");
  56. }
  57. case 6:
  58. {
  59. format(randomDeath, sizeof(randomDeath), "said hello to");
  60. }
  61. case 7:
  62. {
  63. format(randomDeath, sizeof(randomDeath), "delivered some bullets first class to");
  64. }
  65. case 8:
  66. {
  67. format(randomDeath, sizeof(randomDeath), "slayed");
  68. }
  69. case 9:
  70. {
  71. format(randomDeath, sizeof(randomDeath), "mortalized");
  72. }
  73. case 10:
  74. {
  75. format(randomDeath, sizeof(randomDeath), "dropped");
  76. }
  77. case 11:
  78. {
  79. format(randomDeath, sizeof(randomDeath), "pwn3d");
  80. }
  81. case 12:
  82. {
  83. format(randomDeath, sizeof(randomDeath), "unleashed the pain on");
  84. }
  85. case 13:
  86. {
  87. format(randomDeath, sizeof(randomDeath), "avada kedavra'd");
  88. }
  89. case 14:
  90. {
  91. format(randomDeath, sizeof(randomDeath), "humiliated");
  92. }
  93. case 15:
  94. {
  95. format(randomDeath, sizeof(randomDeath), "broke");
  96. }
  97. case 16:
  98. {
  99. format(randomDeath, sizeof(randomDeath), "popped");
  100. }
  101. case 17:
  102. {
  103. format(randomDeath, sizeof(randomDeath), "sends their regards to");
  104. }
  105. case 18:
  106. {
  107. format(randomDeath, sizeof(randomDeath), "now owns");
  108. }
  109. case 19:
  110. {
  111. format(randomDeath, sizeof(randomDeath), "used a classified move on");
  112. }
  113. case 20:
  114. {
  115. format(randomDeath, sizeof(randomDeath), "ended");
  116. }
  117. }
  118.  
  119. for (new i=0; i<MAX_PLAYERS; i++)
  120. {
  121. if(playerData[i][isInDM])
  122. {
  123. new dmKill[100];
  124. format(dmKill, sizeof(dmKill), "{FAAC58}%s(%i) {FFFFFF}%s {FAAC58}%s(%i)", playerData[killerid][playerNamee], killerid, randomDeath, playerData[playerid][playerNamee], playerid);
  125. SendClientMessage(i, COLOR_WHITE, dmKill);
  126. }
  127. }
  128. }
  129.  
  130. playerData[playerid][dmDeaths]++;
  131. playerData[playerid][dmStreak] = 0;
  132. KillTimer(playerData[playerid][streakTimer]);
  133. disableStreak(playerid);
  134. dmStats(playerid);
  135. }
  136. else
  137. {
  138. Server(playerid, "player not detected in dm");
  139. if(!playerData[playerid][playerDied])
  140. {
  141. Server(playerid, "check if player is died and passed");
  142. new vid = GetPlayerVehicleID(killerid);
  143.  
  144. if (killerid != INVALID_PLAYER_ID && GetPlayerWeapon(killerid) != reason && reason != 54 && reason != 50 && reason != 53 && !playerData[playerid][suicide] && GetVehicleModel(vid) != 520 && GetVehicleModel(vid) != 447)
  145. {
  146. Server(playerid, "check for invalid reasons etc.");
  147. if (reason == 49 && IsPlayerInAnyVehicle(killerid))
  148. {
  149. return 1;
  150. }
  151.  
  152. else if (reason == 51 && IsPlayerInAnyVehicle(playerid))
  153. {
  154. return 1;
  155. }
  156.  
  157. else
  158. {
  159. new string[600];
  160.  
  161. format(string, sizeof(string), "%s{98B0CD}Invalid Death Detected \n", string);
  162. format(string, sizeof(string), "%s{FFFFFF}The server does not recognise the reason for your death. \n", string);
  163. format(string, sizeof(string), "%s{FFFFFF}To prevent stat loss, we have an anti-fake kill system in place. \n\n", string);
  164. format(string, sizeof(string), "%s{FFFFFF}If you have respawned at the bank with no weapons, click respawn. \n\n", string);
  165.  
  166. ShowPlayerDialog(playerid, DIALOG_FORCE_RESPAWN, DIALOG_STYLE_MSGBOX, "", string, "RESPAWN", "CANCEL");
  167.  
  168. return 0;
  169. }
  170. }
  171.  
  172. printf("playerid: %d killerid: %d reason: %d", playerid, killerid, reason);
  173. SendDeathMessage(killerid, playerid, reason);
  174. #if !defined LOCALHOST
  175. ircDeath(killerid, playerid, reason);
  176. #endif
  177.  
  178. if(playerData[playerid][playerLoggedIn])
  179. {
  180. if(playerData[playerid][isInEvent])
  181. {
  182. playerData[playerid][isInEvent] = false;
  183. playerData[playerid][hasSpawned] = false;
  184. newPlayerColour(playerid);
  185. playerData[playerid][playerDeaths]++;
  186. playerData[playerid][playerWantedLevel] = 0;
  187. SetPlayerWantedLevel(playerid, 0);
  188. playerData[playerid][hasSTD] = false;
  189. KillTimer(playerData[playerid][rapedTimer]);
  190. }
  191. else
  192. {
  193. if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
  194. {
  195. if(playerData[killerid][playerLoggedIn])
  196. {
  197. playerData[killerid][playerKills] = playerData[killerid][playerKills] + 1;
  198. playerData[killerid][playerScore] = playerData[killerid][playerScore] + 1;
  199. SetPlayerScore(killerid, playerData[killerid][playerScore]);
  200.  
  201. playerGiveXP(playerid, 5);
  202.  
  203. if (playerData[killerid][playerKills] == 1)
  204. {
  205. disableAchieve(killerid);
  206. PlayerTextDrawShow(killerid, playerData[killerid][Achieve1]);
  207. PlayerTextDrawShow(killerid, playerData[killerid][Achieve2]);
  208. PlayerTextDrawShow(killerid, playerData[killerid][Achieve3]);
  209. PlayerTextDrawShow(killerid, playerData[killerid][Achieve4]);
  210.  
  211. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve3], "First Kill");
  212. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve4], "You killed your first victim. Well done.");
  213. PlayerPlaySound(killerid, 1183 ,0.0, 0.0, 0.0);
  214.  
  215. playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve", 8000, false, "i", killerid);
  216.  
  217. // XP/SCORE AWARD
  218. playerGiveXP(playerid, 50);
  219. playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
  220. SetPlayerScore(playerid, playerData[playerid][playerScore]);
  221. }
  222. else if (playerData[killerid][playerKills] == 50)
  223. {
  224. disableAchieve(killerid);
  225. PlayerTextDrawShow(killerid, playerData[killerid][Achieve1]);
  226. PlayerTextDrawShow(killerid, playerData[killerid][Achieve2]);
  227. PlayerTextDrawShow(killerid, playerData[killerid][Achieve3]);
  228. PlayerTextDrawShow(killerid, playerData[killerid][Achieve4]);
  229.  
  230. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve3], "Las Venturas Killer");
  231. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve4], "You've killed 50 players! Nice!");
  232. PlayerPlaySound(killerid, 1183 ,0.0, 0.0, 0.0);
  233.  
  234. playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve", 8000, false, "i", killerid);
  235.  
  236. // XP/SCORE AWARD
  237. playerGiveXP(playerid, 50);
  238. playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
  239. SetPlayerScore(playerid, playerData[playerid][playerScore]);
  240. }
  241. else if (playerData[killerid][playerKills] == 500)
  242. {
  243. disableAchieve(killerid);
  244. PlayerTextDrawShow(killerid, playerData[killerid][Achieve1]);
  245. PlayerTextDrawShow(killerid, playerData[killerid][Achieve2]);
  246. PlayerTextDrawShow(killerid, playerData[killerid][Achieve3]);
  247. PlayerTextDrawShow(killerid, playerData[killerid][Achieve4]);
  248.  
  249. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve3], "Mass Murderer");
  250. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve4], "500 kills attained. You require medical assistance.");
  251. PlayerPlaySound(killerid, 1183 ,0.0, 0.0, 0.0);
  252.  
  253. playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve", 8000, false, "i", killerid);
  254.  
  255. // XP/SCORE AWARD
  256. playerGiveXP(playerid, 50);
  257. playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
  258. SetPlayerScore(playerid, playerData[playerid][playerScore]);
  259. }
  260.  
  261. if(playerData[killerid][playerClass] == CLASS_CIVILIAN || playerData[killerid][playerClass] == CLASS_MEDIC)
  262. {
  263. new message[128];
  264. playerData[killerid][playerWantedLevel] = playerData[killerid][playerWantedLevel] + 12;
  265. SetPlayerWantedLevel(killerid, playerData[killerid][playerWantedLevel] + 12);
  266. format(message, sizeof(message), "{FFDC2E}[MURDER] {FFFFFF}You have just killed %s(%i)!", playerData[playerid][playerNamee], playerid, playerData[killerid][playerWantedLevel]);
  267. SendClientMessage(killerid, COLOR_WHITE, message);
  268. sendWantedMessage(killerid, 12);
  269. newPlayerColour(killerid);
  270.  
  271. if(playerData[killerid][playerJob] == JOB_HITMAN && playerData[killerid][playerClass] != CLASS_MEDIC)
  272. {
  273. if(playerData[playerid][playerHitValue] > 0)
  274. {
  275. playerData[killerid][hitsCompleted] = playerData[killerid][hitsCompleted] + 1;
  276. playerGiveMoney(killerid, playerData[playerid][playerHitValue]);
  277. format(message, sizeof(message), "{FFDC2E}[CONTRACT] {FFFFFF}%s(%i) has completed the contract on %s(%i) and earnt {FFDC2E}$%s", playerData[killerid][playerNamee], killerid, playerData[playerid][playerNamee], playerid, FormatNumber(playerData[playerid][playerHitValue]));
  278. SendClientMessageToAll(COLOR_WHITE, message);
  279.  
  280. new loggingString[256];
  281. format(loggingString, sizeof(loggingString), "%s completed the contract on %s for %d.", playerData[killerid][playerNamee], playerData[playerid][playerNamee], playerData[playerid][playerHitValue]);
  282. writeInLog("contractLog.html", loggingString);
  283.  
  284. playerData[playerid][playerHitValue] = 0;
  285.  
  286. if (playerData[killerid][hitsCompleted] == 1)
  287. {
  288. disableAchieve(killerid);
  289. PlayerTextDrawShow(killerid, playerData[killerid][Achieve1]);
  290. PlayerTextDrawShow(killerid, playerData[killerid][Achieve2]);
  291. PlayerTextDrawShow(killerid, playerData[killerid][Achieve3]);
  292. PlayerTextDrawShow(killerid, playerData[killerid][Achieve4]);
  293.  
  294. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve3], "Contract Killer");
  295. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve4], "You completed your first hit contract!");
  296. PlayerPlaySound(killerid, 1183 ,0.0, 0.0, 0.0);
  297.  
  298. playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve", 8000, false, "i", killerid);
  299.  
  300. // XP/SCORE AWARD
  301. playerGiveXP(playerid, 50);
  302. playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
  303. SetPlayerScore(playerid, playerData[playerid][playerScore]);
  304. }
  305.  
  306. if (playerData[killerid][hitsCompleted] == 20)
  307. {
  308. disableAchieve(killerid);
  309. PlayerTextDrawShow(killerid, playerData[killerid][Achieve1]);
  310. PlayerTextDrawShow(killerid, playerData[killerid][Achieve2]);
  311. PlayerTextDrawShow(killerid, playerData[killerid][Achieve3]);
  312. PlayerTextDrawShow(killerid, playerData[killerid][Achieve4]);
  313.  
  314. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve3], "Professional Hitman");
  315. PlayerTextDrawSetString(killerid, playerData[killerid][Achieve4], "You completed 20 hit contracts!");
  316. PlayerPlaySound(killerid, 1183 ,0.0, 0.0, 0.0);
  317.  
  318. playerData[playerid][achieveTimer] = SetTimerEx("disableAchieve", 8000, false, "i", killerid);
  319.  
  320. // XP/SCORE AWARD
  321. playerGiveXP(playerid, 50);
  322. playerData[playerid][playerScore] = playerData[playerid][playerScore] + 2;
  323. SetPlayerScore(playerid, playerData[playerid][playerScore]);
  324. }
  325. }
  326. }
  327.  
  328. playerData[killerid][playerLastKill] = GetTickCount();
  329. }
  330.  
  331. if(playerData[playerid][playerClass] == CLASS_CIVILIAN || playerData[playerid][playerClass] == CLASS_MEDIC)
  332. {
  333. newPlayerColour(playerid);
  334. }
  335.  
  336. if(playerData[killerid][playerClass] == CLASS_POLICE || playerData[killerid][playerClass] == CLASS_ARMY || playerData[killerid][playerClass] == CLASS_CIA || playerData[killerid][playerClass] == CLASS_FBI || playerData[killerid][playerClass] == CLASS_SECRETSERVICE)
  337. {
  338. if(playerData[playerid][playerWantedLevel] == 0)
  339. {
  340. if (!playerData[playerid][suicide])
  341. {
  342. if (playerData[killerid][playerClass] == CLASS_POLICE || playerData[killerid][playerClass] == CLASS_FBI || playerData[killerid][playerClass] == CLASS_CIA || playerData[killerid][playerClass] == CLASS_SECRETSERVICE)
  343. {
  344. playerData[killerid][innocentKills]++;
  345.  
  346. if (playerData[killerid][innocentKills] > 2)
  347. {
  348. playerGiveMoney(killerid, -5000);
  349. }
  350.  
  351. if (playerData[killerid][innocentKills] == 5)
  352. {
  353. // Cop class ban
  354.  
  355. ForceClassSelection(killerid);
  356. TogglePlayerSpectating(killerid, true);
  357. TogglePlayerSpectating(killerid, false);
  358.  
  359. playerData[killerid][playerCopBanned] = 1;
  360.  
  361. }
  362. else
  363. {
  364. SetPlayerHealth(killerid, 0.0);
  365. }
  366. }
  367.  
  368. if (playerData[killerid][playerClass] == CLASS_ARMY)
  369. {
  370. playerData[killerid][aInnocentKills]++;
  371. playerGiveMoney(killerid, -5000);
  372.  
  373. if (playerData[killerid][aInnocentKills] == 3)
  374. {
  375. // Army class ban
  376.  
  377. ForceClassSelection(killerid);
  378. TogglePlayerSpectating(killerid, true);
  379. TogglePlayerSpectating(killerid, false);
  380.  
  381. playerData[killerid][playerArmyBanned] = 1;
  382.  
  383. }
  384. else
  385. {
  386. SetPlayerHealth(killerid, 0.0);
  387. }
  388. }
  389.  
  390. closeDialogs(killerid);
  391.  
  392. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill1]);
  393. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill2]);
  394. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill3]);
  395. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill4]);
  396. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill5]);
  397. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill6]);
  398. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill7]);
  399. PlayerTextDrawShow(killerid, playerData[killerid][InnocentKill8]);
  400. }
  401. }
  402. else if(playerData[playerid][playerWantedLevel] > 0)
  403. {
  404. new message[128], earnings;
  405. earnings = (playerData[playerid][playerWantedLevel] * 200);
  406. format(message, sizeof(message), "{FFDC2E}[KILL] {FFFFFF}You killed %s(%i) who had a wanted level of %i, you earnt {FFDC2E}$%s!", playerData[playerid][playerNamee], playerid, playerData[playerid][playerWantedLevel], FormatNumber(earnings));
  407. SendClientMessage(killerid, COLOR_WHITE, message);
  408. playerGiveMoney(killerid, earnings);
  409.  
  410. playerGiveXP(killerid, 5);
  411. playerData[killerid][copKills] = playerData[killerid][copKills] + 1;
  412.  
  413. new loggingString[256];
  414. format(loggingString, sizeof(loggingString), "%s killed %s for %d.", playerData[killerid][playerNamee], playerData[playerid][playerNamee], earnings);
  415. writeInLog("copKillLog.html", loggingString);
  416. }
  417. }
  418. }
  419. }
  420.  
  421. if(playerData[playerid][iscourier])
  422. {
  423. SendClientMessage(playerid, COLOR_WHITE, "{FFDC2E}[COURIER] {FFFFFF}You died, the mission was cancelled.");
  424. playerData[playerid][iscourier] = false;
  425. playerData[playerid][playerCourierLevel] = 0;
  426. DisablePlayerCheckpoint(playerid);
  427. }
  428.  
  429. if (playerData[playerid][truckingStatus] > 0)
  430. {
  431. return cmd_canceltrucking(playerid, "");
  432. }
  433.  
  434. if (playerData[playerid][forkliftStatus] > 0)
  435. {
  436. return cmd_cancelforklift(playerid, "");
  437. }
  438.  
  439. if (playerData[playerid][busStatus] > 0)
  440. {
  441. return cmd_cancelroute(playerid, "");
  442. }
  443.  
  444. playerData[playerid][playerDeaths]++;
  445. playerData[playerid][playerDied] = true;
  446. playerData[playerid][playerWantedLevel] = 0;
  447. SetPlayerWantedLevel(playerid, 0);
  448. playerData[playerid][hasSTD] = false;
  449. KillTimer(playerData[playerid][rapedTimer]);
  450. KillTimer(playerData[playerid][uncuffTimer]);
  451. playerData[playerid][playerIsTied] = false;
  452. SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);
  453. KillTimer(playerData[playerid][untieTimer]);
  454. playerData[playerid][hasSpawned] = false;
  455. playerData[playerid][suicide] = false;
  456.  
  457. if (!playerData[playerid][healthInsurance])
  458. {
  459. taxplayer(playerid);
  460. }
  461. }
  462. }
  463. }
  464. }
  465.  
  466. return 1;
  467. }
Advertisement
Add Comment
Please, Sign In to add comment