detective_job.inc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. file: jobs/detective_job.inc
  3. description: The detective job for SARP.
  4. author: Unknown
  5. improved by: Jay Cortez
  6. date created: 29th March 2018
  7. */
  8. // Command to track a player
  9. CMD:find(playerid, params[])
  10. {
  11. if( PlayerInfo[playerid][pJob] != 1 &&
  12. PlayerInfo[playerid][pGroup] != GROUP_S9 &&
  13. PlayerInfo[playerid][pMember] != FACTION_FBI &&
  14. PlayerInfo[playerid][pGroup] != GROUP_HITMAN
  15. ) return SendClientMessage(playerid, COLOR_GREY, "You are not a detective.");
  16. if(gettime() < UsedFind[playerid] + FReloadTime[playerid])
  17. return SendClientMessage(playerid, COLOR_GREY, "You've already searched for someone, you must wait your reload time.");
  18. if(CheckForJammer(playerid))
  19. return SendClientMessage(playerid, COLOR_GREY, "Tracker signal blocked.");
  20. new targetid;
  21. if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /find [playerid/PartOfName]");
  22. if(PlayerInfo[targetid][pPnumber] == 0)
  23. return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a cellphone.");
  24. if(!IsPlayerConnected(targetid))
  25. return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");
  26. if(PlayerInfo[targetid][pAdmin] && PlayerInfo[targetid][pStealthed] == 0 )
  27. return SendClientMessage(playerid, COLOR_GREY, "You cannot track admins.");
  28. if(targetid == playerid)
  29. return SendClientMessage(playerid, COLOR_GREY, "You cannot track yourself.");
  30. if(
  31. GetPlayerInterior(targetid) != 0 ||
  32. PlayerInfo[targetid][pMask] ||
  33. GetPlayerState(targetid) == PLAYER_STATE_SPECTATING ||
  34. GetPlayerVirtualWorld(targetid) != 0 ||
  35. PlayerInfo[targetid][pAdmin] && PlayerInfo[targetid][pStealthed]
  36. ) return SendClientMessage(playerid, COLOR_GREY, "That player is currently inside.");
  37. if(PhoneOffline[targetid])
  38. return SendClientMessage(playerid, COLOR_GREY, "No signal was returned.");
  39. if(CheckForJammer(targetid))
  40. return SendClientMessage(playerid, COLOR_GREY, "A very weak signal was returned.");
  41. new points, zone[MAX_ZONE_NAME], level = PlayerInfo[playerid][pDetSkill];
  42. GetPlayer2DZone(targetid, zone, MAX_ZONE_NAME);
  43. if(level >= 0 && level <= 49)
  44. {
  45. points = 4;
  46. FReloadTime[playerid] = 120;
  47. }
  48. else if(level >= 50 && level <= 99)
  49. {
  50. points = 6;
  51. FReloadTime[playerid] = 80;
  52. }
  53. else if(level >= 100 && level <= 199)
  54. {
  55. points = 8;
  56. FReloadTime[playerid] = 60;
  57. }
  58. else if(level >= 200 && level <= 399)
  59. {
  60. points = 10;
  61. FReloadTime[playerid] = 30;
  62. }
  63. else if(level >= 400)
  64. {
  65. points = 12;
  66. FReloadTime[playerid] = 20;
  67. }
  68. if(PlayerInfo[playerid][pGroup] == GROUP_S9 || PlayerInfo[playerid][pMember] == FACTION_FBI) {
  69. FReloadTime[playerid] = 0;
  70. points = 30;
  71. }
  72. new trackStr[128];
  73. // Action
  74. format(trackStr, sizeof(trackStr), "* %s begins to track a signal.", PlayerICName(playerid));
  75. ProxDetector(15.0, playerid, trackStr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
  76. // Set the marker
  77. SetPlayerMarkerForPlayer(playerid, targetid, 0x9B0000AA);
  78. // Send message
  79. format(trackStr, sizeof(trackStr), "%s's cellphone signal points to %s.", PlayerICName(targetid), zone);
  80. SendClientMessage(playerid, COLOR_GREY, trackStr);
  81. FindingID[playerid] = targetid;
  82. FindTime[playerid] = 1;
  83. UsedFind[playerid] = gettime();
  84. FindTimePoints[playerid] = points;
  85. PlayerInfo[playerid][pDetSkill] ++;
  86. // Skill has been increased
  87. if(PlayerInfo[playerid][pDetSkill] == 50)
  88. SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 2, you now have a 80 second reload time.");
  89. else if(PlayerInfo[playerid][pDetSkill] == 100)
  90. SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 3, you now have a 60 second reload time.");
  91. else if(PlayerInfo[playerid][pDetSkill] == 200)
  92. SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 4, you now have a 30 second reload time.");
  93. else if(PlayerInfo[playerid][pDetSkill] == 400)
  94. SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 5, you now have a 20 second reload time.");
  95. return 1;
  96. }
  97. // Called every second
  98. detective_SecondSync(playerid) {
  99. if(FindTime[playerid])
  100. {
  101. if(FindTime[playerid] == FindTimePoints[playerid])
  102. {
  103. PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
  104. displayCenterHUDInfo(playerid, "~r~Tracker lost signal...", 8);
  105. FindTime[playerid] = 0;
  106. FindTimePoints[playerid] = 0;
  107. new target = FindingID[playerid];
  108. if(Called911[target] != 0)
  109. {
  110. SetAllCopCheckpoint(target);
  111. }
  112. else
  113. {
  114. SetPlayerToTeamColor(target);
  115. }
  116. FindingID[playerid] = 0;
  117. }
  118. else
  119. {
  120. new trackStr[128];
  121. format(trackStr, sizeof(trackStr), "~r~Tracker time left: ~w~%i", FindTimePoints[playerid] - FindTime[playerid]);
  122. displayCenterHUDInfo(playerid, trackStr, 8); //display for 8 seconds
  123. FindTime[playerid] += 1;
  124. }
  125. }
  126. return 1;
  127. }