Guest User

Untitled

a guest
Mar 11th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.80 KB | None | 0 0
  1. public OnPlayerDeath(playerid, killerid, reason)
  2. {
  3. KillTimerIfPossible(playerid), TogglePlayerTextdraw(playerid, false), TogglePlayerTVScreen(playerid, false);
  4. RemovePlayerAttachedObject(playerid, 1);
  5. if(IsPlayerLoggedIn(playerid))
  6. {
  7. PlayerDeath[playerid] = 1;
  8. new Float:getx,Float:gety,Float:getz;
  9. GetPlayerPos(playerid, getx, gety, getz);
  10. PlayerxPos[playerid] =-getx;
  11. PlayeryPos[playerid] =gety;
  12. PlayerzPos[playerid] =getz;
  13. SaveChar(playerid);
  14. HavingBall[playerid] = 0;
  15. if(HavingBall[playerid]) Baller = 999;
  16. if(DayNoDrops == 1)
  17. {
  18. for(new i=0; i<13; i++)
  19. {
  20. GetPlayerWeaponData(playerid, i, DNDW[i][0], DNDW[i][1]);
  21. }
  22. }
  23. if(Planted[playerid] == 1)
  24. {
  25. DestroyObject(C4[playerid]);
  26. Bomb[playerid] = 0;
  27. Planted[playerid] = 0;
  28. }
  29. Pspawned[playerid] = 0;
  30. new string[128];
  31. if(BankRobber[playerid])
  32. {
  33. new Rob = BankRobber[playerid]-1;
  34. DisablePlayerCheckpoint(playerid);
  35. BankRobbersCount --;
  36. format(BankRobbers[Rob], MAX_PLAYER_NAME, "");
  37. DeliverMoney[playerid] = 0;
  38. //
  39. foreach(Player, i)
  40. {
  41. if(BankRobber[i] || PlayerInfo[i][pFac] == 1)
  42. {
  43. if(Rob == 0) TextDrawHideForPlayer(i, Textdraw1);
  44. else if(Rob == 1) TextDrawHideForPlayer(i, Textdraw2);
  45. else if(Rob == 2) TextDrawHideForPlayer(i, Textdraw3);
  46. else if(Rob == 3) TextDrawHideForPlayer(i, Textdraw4);
  47. else if(Rob == 4) TextDrawHideForPlayer(i, Textdraw5);
  48. }
  49. }
  50. format(string, sizeof(string), "** %s has been hospitalized and has failed the robbery. **", RPN(playerid));
  51. SendRobberyMessage(COLOR_LIGHTRED, string);
  52. SendCopMessage(COLOR_LIGHTRED, string);
  53. BankRobber[playerid] = 0;
  54. if(BankRobbersCount == 0)
  55. {
  56. TextDrawHideForAll(Textdraw0);
  57. TextDrawHideForAll(Textdraw1);
  58. TextDrawHideForAll(Textdraw2);
  59. TextDrawHideForAll(Textdraw3);
  60. TextDrawHideForAll(Textdraw4);
  61. TextDrawHideForAll(Textdraw5);
  62. // BankRobbery = 0;
  63. RobberyStarted = 0;
  64. format(string, sizeof(string), "** The bank robbery has ended, $%d were stolen and $%d were saved. **", TotalStolen*10000, (TotalRobbers*10000-(TotalStolen*10000)));
  65. SendClientMessageToAll(COLOR_YELLOW, string);
  66. TotalRobbers = 0;
  67. new copsonline;
  68. foreach(Player, i)
  69. {
  70. if(IsACop(i)) copsonline++;
  71. }
  72. foreach(Player, i)
  73. {
  74. if(IsACop(i))
  75. {
  76. new Saved = (TotalRobbers*10000-(TotalStolen*10000));
  77. GiveDodMoney(i, Saved/copsonline);
  78. format(string, sizeof(string), "** You have received your cut from the saved money. ($%d)", Saved/copsonline);
  79. SendClientMessage(i, COLOR_LIME, string);
  80. }
  81. }
  82. }
  83. }
  84. if(!IsAFK[playerid])
  85. {
  86. if(Event[playerid])
  87. {
  88. format(string, sizeof(string), "OnEventDeath: %s has killed %s using %s.", RPN(killerid), RPN(playerid), RWN(reason));
  89. foreach(Player, i)
  90. {
  91. if(Event[i]) SendClientMessage(i, COLOR_REPORT, string);
  92. }
  93. Event[playerid] = 0;
  94. eventdeath[playerid] = 1;
  95. }
  96. if(PlayerPaintballing[playerid] == 1)
  97. {
  98. for (new i = 0; i < 13; i++)
  99. {
  100. GetPlayerWeaponData(playerid, i, pbGuns[i][0], pbGuns[i][1]);
  101. }
  102. format(string, sizeof(string), "OnPaintballDeath: %s has killed %s using %s.", RPN(killerid), RPN(playerid), RWN(reason));
  103. new Float:myhp;
  104. GetPlayerHealth(killerid, myhp);
  105. SetPlayerHealth(killerid, myhp+30);
  106. if(myhp == 100)
  107. {
  108. SetPlayerHealth(killerid, 100);
  109. }
  110. foreach(Player, i)
  111. {
  112. if(PlayerPaintballing[i]) SendClientMessage(i, COLOR_REPORT, string);
  113. }
  114. PlayerPaintballing[playerid] = 1;
  115. }
  116. else
  117. {
  118. PlayerInfo[playerid][pHospital] = 1;
  119. PlayerInfo[playerid][pArmor] = 0;
  120. if(IsPlayerLoggedIn(killerid))
  121. {
  122. format(string, sizeof(string), "SMRT: %s je ubio %s Oruzjem %s.", RPN(killerid), RPN(playerid), RWN(reason));
  123. SendAdminMessage(COLOR_DARKRED, 1, string);
  124. Log("logs/kill.log", string);
  125. PlayerInfo[playerid][pDeath] ++;
  126. PlayerInfo[killerid][pKill] ++;
  127. if(Hitman[killerid] == playerid)
  128. {
  129. format(string, sizeof(string), " You have been critically injured by a hitman and lost $%d, the contrat on your head was cleared.", PlayerInfo[playerid][pContract]/2);
  130. SendClientMessage(playerid, COLOR_YELLOW, string);
  131. format(string, sizeof(string), "HitmanWarn: %s has fulfilled the contract on %s's head and collected $%d.", RPN(killerid), RPN(playerid), PlayerInfo[playerid][pContract]/2);
  132. SendHitmanMessage(COLOR_YELLOW, string);
  133. GiveDodMoney(playerid, -PlayerInfo[playerid][pContract]/2);
  134. GiveDodMoney(killerid, PlayerInfo[playerid][pContract]/2);
  135. PlayerInfo[playerid][pContract] = 0;
  136. format(PlayerInfo[playerid][pContract], 32, "");
  137. Hitman[killerid] = -1;
  138. PlayerInfo[killerid][pCSuccess] ++;
  139. }
  140. if(Hitman[playerid] == killerid)
  141. {
  142. format(string, sizeof(string), " You have critically injured a hitman and collected $%d, the contrat on your head was cleared.", PlayerInfo[killerid][pContract]);
  143. SendClientMessage(killerid, COLOR_YELLOW, string);
  144. format(string, sizeof(string), "HitmanWarn: %s has failed the contract on %s's head and lost $%d.", RPN(playerid), RPN(killerid), PlayerInfo[killerid][pContract]);
  145. SendHitmanMessage(COLOR_YELLOW, string);
  146. GiveDodMoney(playerid, -PlayerInfo[killerid][pContract]);
  147. GiveDodMoney(killerid, PlayerInfo[killerid][pContract]);
  148. PlayerInfo[killerid][pContract] = 0;
  149. format(PlayerInfo[killerid][pContract], 32, "");
  150. Hitman[playerid] = -1;
  151. PlayerInfo[playerid][pCFail] ++;
  152. }
  153. }
  154. }
  155. }
  156. else
  157. {
  158. GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
  159. ClearDodWantedLevels(killerid);
  160. SetPlayerColor(killerid, TRANSPARENT_ORANGE);
  161. PlayerInfo[killerid][pPrison] = 2;
  162. PlayerInfo[killerid][pPrisonTime] = AFK[playerid];
  163. format(PlayerInfo[killerid][pPrisonReason], 64, "AFK igrac.");
  164. format(PlayerInfo[killerid][pPrisonBy], 32, "AUTO");
  165. TogglePlayerControllable(killerid, 0);
  166. SetTimerEx("EnterExitTimer", 5000, false, "i", killerid);
  167. SetPlayerPos(killerid, 2861.3999023438,-1768.0999755859,13.60000038147);
  168. SetCameraBehindPlayer(killerid);
  169. format(string, sizeof(string), "AdmCmd: %s je zatvoren, razlog: AFK Igra [%d Minuta]", RPN(killerid), AFK[playerid]/60);
  170. SendClientMessageToAll(COLOR_LIGHTRED, string);
  171. Log("logs/prison.log", string);
  172. format(string, sizeof(string), " Automatski jail: %d minuta (%d sekundi)", PlayerInfo[killerid][pPrisonTime]/60, PlayerInfo[killerid][pPrisonTime]);
  173. SendClientMessage(killerid, COLOR_LIGHTBLUE, string);
  174. }
  175. }
  176. return 1;
  177.  
  178. }
  179.  
  180. =======================================================================================================================================================================================================================================================================================================================================================================================================================================================ON PLAYER SPAWN ===============================================================
  181. =================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================
  182. public OnPlayerSpawn(playerid)
  183. {
  184. TogglePlayerSpectating(playerid, false);
  185. // Anti F4 Bug - Logging/Registering
  186. if(!PlayerInfo[playerid][pLoggedIn] && !IsPlayerNPC(playerid))
  187. {
  188. if(IsPlayerNPC(playerid)) return 1;
  189. SetPlayerPos(playerid, -262.3460,-1394.9241,26.6859);
  190. SetSpawnInfo( playerid, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
  191. new file[64];
  192. format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
  193. // Player isn't banned
  194. if(dini_Int(file, "AdminAccount") == 1)
  195. {
  196. format(file, sizeof(file), "users/%s.ini",RPNU(playerid));
  197. SetPlayerName(playerid, dini_Get(file, "OldName"));
  198. format(file, sizeof(file), "users/%s.ini", RPNU(playerid));
  199. ShowDialog(playerid, 2);
  200. }
  201. if(!dini_Exists(file))
  202. {
  203. ShowDialog(playerid, 1);
  204. return 1;
  205. }
  206. else
  207. {
  208. ShowDialog(playerid, 2);
  209. }
  210. return 1;
  211. }
  212. ResetPlayerWeapons(playerid);
  213. if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  214. {
  215. new npcname[MAX_PLAYER_NAME];
  216. GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
  217. if(!strcmp(npcname, "GOD", true)) //Checking if the NPC's name is GOD
  218. { //Putting the NPC into the vehicle we created for it.
  219. return 1;
  220. }
  221. return 1;
  222. }
  223. if(PlayerInfo[playerid][pLoggedIn] && PlayerInfo[playerid][pSpawn])
  224. {
  225.  
  226. SpawnChar(playerid);
  227. }
  228. if (!GetPVarInt(playerid, "color")) SetPVarInt(playerid, "color", 18643);
  229. if(PlayerDeath[playerid] == 1){
  230. SetPlayerPos(playerid, -262.3460[playerid], -1394.9241[playerid], 26.6859[playerid]);
  231. PlayerDied[playerid] = 0;
  232. SetPlayerHealth(playerid, 100);
  233. TogglePlayerControllable(playerid, 0);
  234. SetTimerEx("KillAnim", 2500, false, "i", playerid);
  235. PlayerInfo[playerid][pSpawnFreeze] = 1;
  236. }
  237. return 1;
  238. }
Advertisement
Add Comment
Please, Sign In to add comment