Advertisement
Guest User

OnPlayerDeath

a guest
Nov 8th, 2015
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.38 KB | None | 0 0
  1. public OnPlayerDeath(playerid, killerid, reason)
  2. {
  3. Alive[playerid] = 0;
  4. CheckDelay[playerid] = 10;
  5. TextDrawHideForPlayer(playerid, Status[playerid]);
  6. new vehicleid = GetPlayerVehicleID(playerid);
  7. if(vehicleVariables[vehicleid][vVehicleJob] == 7)
  8. {
  9. format(szMessage, sizeof(szMessage), "Job failed.");
  10. SCM(playerid, COLOR_NOB, szMessage);
  11. SetVehicleToRespawnEx(vehicleid);
  12. KillTimer(mowertimer[playerid]);
  13. MowerMoney[playerid] = 0;
  14. TextDrawHideForPlayer(playerid,Mower[playerid]);
  15. PlayerData[playerid][pFarmerMoney] = 0;
  16. PlayerData[playerid][pCheckpoint] = 0;
  17. CP[playerid] = 0;
  18.  
  19. }
  20. if(PlayerPaintballing[playerid] != 0)
  21. {
  22. new string[500];
  23.  
  24.  
  25. new pinfo[128];
  26. KillP[killerid]++;
  27. DeathP[playerid]++;
  28.  
  29. format(string, sizeof(string), "You have killed %s. You now have %d kills.",GetName(playerid), KillP[killerid]);
  30. SendClientMessage(killerid, COLOR_GENANNOUNCE, string);
  31.  
  32. format(string, sizeof(string), "You have been killed by %s.",GetName(killerid));
  33. SendClientMessage(playerid, COLOR_GENANNOUNCE, string);
  34.  
  35. PlayerPaintballScore[killerid] = KillP[killerid];
  36. if(PlayerPaintballScore[killerid] > PaintballWinnerScore)
  37. {
  38. PaintballWinner = killerid;
  39. PaintballWinnerScore = PlayerPaintballScore[killerid];
  40. foreach(Player,i)
  41. {
  42. if(IsPlayerConnected(i))
  43. {
  44. if(PlayerPaintballing[i] != 0)
  45. {
  46. format(pinfo,sizeof(pinfo),"%s is now in lead with %d kills.",GetName(PaintballWinner),PaintballWinnerScore);
  47. SCM(i, COLOR_YELLOW, pinfo);
  48. }
  49. }
  50. }
  51. }
  52. return 1;
  53. }
  54. KillTimer(mowertimer[playerid]);
  55. if(PlayerData[playerid][pHeadValue] > 0)
  56. {
  57. if(IsPlayerConnected(killerid))
  58. {
  59. if(PlayerData[killerid][pGroup] == 10)
  60. {
  61. if(GoChase[killerid] == playerid)
  62. {
  63. new string[256], string2[128];
  64. new killer[MAX_PLAYER_NAME];
  65. new name[MAX_PLAYER_NAME];
  66. GetPlayerName(killerid, killer, sizeof(killer));
  67. GetPlayerName(playerid, name, sizeof(name));
  68. PlayerData[killerid][pMoney] += PlayerData[playerid][pHeadValue];
  69. format(string,128,"Hitman %s has fullfiled the contract on %s and collected $%d, distance: %.0fm.",killer,name,PlayerData[playerid][pHeadValue], GetDistanceBetweenPlayers(killerid, playerid));
  70. SendToGroup(10, COLOR_HITMAN, string);
  71. format(string2,128,"( HOT News ):{3366FF} %s{FFFFFF} has been assassinated by a unknown hitman.",name);
  72. SendClientMessageToAll(COLOR_HITMAN, string2);
  73. PlayerData[playerid][pHeadValue] = -1;
  74. GotHit[playerid] = 0;
  75. GetChased[playerid] = 999;
  76. GoChase[killerid] = 999;
  77. }
  78. }
  79. }
  80. }
  81. if(IsPlayerConnected(killerid))
  82. {
  83. new currentveh;
  84. currentveh = GetPlayerVehicleID(playerid);
  85. if(GetPlayerState(killerid) == PLAYER_STATE_DRIVER && !IsAPlane(currentveh))
  86. {
  87. new name[25], kill[25], string[128];
  88. GetPlayerName(playerid,name,sizeof(name));
  89. GetPlayerName(killerid,kill,sizeof(kill));
  90. format(string, sizeof(string), "{f03337}Warning: Player %s(%d) was killed by %s(%d) with drive-by.", name,playerid,kill,killerid);
  91. submitToHelpersAndAdmins(string, COLOR_WHITE);
  92. }
  93. }
  94. if(PlayerData[playerid][pAdminLevel] >= 1 && AdminDuty[playerid] == 1)
  95. {
  96. AdminDuty[playerid] = 0;
  97. }
  98. else if(PlayerData[playerid][pHelper] >= 1 && HelperDuty[playerid] == 1)
  99. {
  100. HelperDuty[playerid] = 0;
  101. }
  102. new turfkiller, turfplayerid;
  103. for(new i = 0; i <= sizeof(TurfInfo); i++)
  104. {
  105. if(IsPlayerInTurf(playerid, i) == 1)
  106. {
  107. turfplayerid = i;
  108. break;
  109. }
  110. }
  111. for(new i = 0; i <= sizeof(TurfInfo); i++)
  112. {
  113. if(IsPlayerInTurf(killerid, i) == 1)
  114. {
  115. turfkiller = i;
  116. break;
  117. }
  118. }
  119. new string[256];
  120. if(WarInfo[turfplayerid][wTime] > 0 && WarInfo[turfkiller][wTime] > 0)
  121. {
  122. if(turfplayerid == turfkiller)
  123. {
  124. if(PlayerData[playerid][pGroup] == WarInfo[turfplayerid][wAttacker] && PlayerData[killerid][pGroup] == WarInfo[turfplayerid][wFaction])
  125. {
  126. PlayerData[playerid][pWarDeaths] += 1;
  127. format(string, sizeof(string), "You have been killed by %s (%i)", PlayerData[killerid][pNormalName], killerid);
  128. SCM(playerid, COLOR_GENANNOUNCE, string);
  129.  
  130. groupVariables[WarInfo[turfkiller][wFaction]][gScore] += 1;
  131. PlayerData[killerid][pWarScore] += 1;
  132. format(string, sizeof(string), "You have killed %s (%i).", PlayerData[playerid][pNormalName], playerid);
  133. SCM(killerid, COLOR_GENANNOUNCE, string);
  134. SCM(playerid, COLOR_LIGHTBLUE, "You will be spawned in the HQ.");
  135. }
  136. else if(PlayerData[killerid][pGroup] == WarInfo[turfkiller][wAttacker] && PlayerData[playerid][pGroup] == WarInfo[turfkiller][wFaction])
  137. {
  138. PlayerData[playerid][pWarDeaths] += 1;
  139. format(string, sizeof(string), "You have been killed by %s (%i).", PlayerData[killerid][pNormalName], killerid);
  140. SCM(playerid, COLOR_GENANNOUNCE, string);
  141.  
  142. groupVariables[WarInfo[turfplayerid][wAttacker]][gScore] += 1;
  143. PlayerData[killerid][pWarScore] += 1;
  144. format(string, sizeof(string), "You have killed %s (%i).", PlayerData[playerid][pNormalName], playerid);
  145. SCM(killerid, COLOR_GENANNOUNCE, string);
  146. SCM(playerid, COLOR_LIGHTBLUE, "You will be spawned in group HQ.");
  147. }
  148. }
  149. }
  150. if((WarInfo[turfkiller][wTime] != 0 && (WarInfo[turfkiller][wAttacker] == PlayerData[playerid][pGroup] || WarInfo[turfkiller][wFaction] == PlayerData[playerid][pGroup]) && PlayerData[playerid][pGroup] != 0) || (PlayerData[killerid][pGroup] == 1
  151. || PlayerData[killerid][pGroup] == 2 || PlayerData[killerid][pGroup] == 3 || PlayerData[killerid][pGroup] == 5) || (PlayerData[playerid][pGroup] == 1 || PlayerData[playerid][pGroup] == 2 || PlayerData[playerid][pGroup] == 3 || PlayerData[playerid][pGroup] == 5) || (PlayerData[playerid][pGroup] == PlayerData[killerid][pGroup]) || (PlayerPaintballing[killerid] >= 1))
  152. {
  153.  
  154. }
  155. else
  156. {
  157. WantedID[playerid] = killerid;
  158. SCM(playerid, COLOR_WHITE, "{E60000}[KILL]: {FFFFFF}%s murdered you, use [/call 112]. You have 60 seconds to announce the police.");
  159. WantedIDTime[playerid] = 60;
  160. }
  161. //SetTimerEx("Spawn", 3999, 0, "d", playerid);
  162. SetPlayerHealth(playerid, 0);
  163. killerid = INVALID_PLAYER_ID;
  164. return 1;
  165. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement