| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- /*
- file: jobs/detective_job.inc
- description: The detective job for SARP.
- author: Unknown
- improved by: Jay Cortez
- date created: 29th March 2018
- */
- // Command to track a player
- CMD:find(playerid, params[])
- {
- if( PlayerInfo[playerid][pJob] != 1 &&
- PlayerInfo[playerid][pGroup] != GROUP_S9 &&
- PlayerInfo[playerid][pMember] != FACTION_FBI &&
- PlayerInfo[playerid][pGroup] != GROUP_HITMAN
- ) return SendClientMessage(playerid, COLOR_GREY, "You are not a detective.");
- if(gettime() < UsedFind[playerid] + FReloadTime[playerid])
- return SendClientMessage(playerid, COLOR_GREY, "You've already searched for someone, you must wait your reload time.");
- if(CheckForJammer(playerid))
- return SendClientMessage(playerid, COLOR_GREY, "Tracker signal blocked.");
- new targetid;
- if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, COLOR_GREY, "{00BFFF}Usage:{FFFFFF} /find [playerid/PartOfName]");
-
- if(PlayerInfo[targetid][pPnumber] == 0)
- return SendClientMessage(playerid, COLOR_GREY, "That player doesn't have a cellphone.");
- if(!IsPlayerConnected(targetid))
- return SendClientMessage(playerid, COLOR_GREY, "Unknown player.");
- if(PlayerInfo[targetid][pAdmin] && PlayerInfo[targetid][pStealthed] == 0 )
- return SendClientMessage(playerid, COLOR_GREY, "You cannot track admins.");
- if(targetid == playerid)
- return SendClientMessage(playerid, COLOR_GREY, "You cannot track yourself.");
- if(
- GetPlayerInterior(targetid) != 0 ||
- PlayerInfo[targetid][pMask] ||
- GetPlayerState(targetid) == PLAYER_STATE_SPECTATING ||
- GetPlayerVirtualWorld(targetid) != 0 ||
- PlayerInfo[targetid][pAdmin] && PlayerInfo[targetid][pStealthed]
- ) return SendClientMessage(playerid, COLOR_GREY, "That player is currently inside.");
- if(PhoneOffline[targetid])
- return SendClientMessage(playerid, COLOR_GREY, "No signal was returned.");
- if(CheckForJammer(targetid))
- return SendClientMessage(playerid, COLOR_GREY, "A very weak signal was returned.");
- new points, zone[MAX_ZONE_NAME], level = PlayerInfo[playerid][pDetSkill];
- GetPlayer2DZone(targetid, zone, MAX_ZONE_NAME);
- if(level >= 0 && level <= 49)
- {
- points = 4;
- FReloadTime[playerid] = 120;
- }
- else if(level >= 50 && level <= 99)
- {
- points = 6;
- FReloadTime[playerid] = 80;
- }
- else if(level >= 100 && level <= 199)
- {
- points = 8;
- FReloadTime[playerid] = 60;
- }
- else if(level >= 200 && level <= 399)
- {
- points = 10;
- FReloadTime[playerid] = 30;
- }
- else if(level >= 400)
- {
- points = 12;
- FReloadTime[playerid] = 20;
- }
- if(PlayerInfo[playerid][pGroup] == GROUP_S9 || PlayerInfo[playerid][pMember] == FACTION_FBI) {
- FReloadTime[playerid] = 0;
- points = 30;
- }
- new trackStr[128];
- // Action
- format(trackStr, sizeof(trackStr), "* %s begins to track a signal.", PlayerICName(playerid));
- ProxDetector(15.0, playerid, trackStr, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
- // Set the marker
- SetPlayerMarkerForPlayer(playerid, targetid, 0x9B0000AA);
- // Send message
- format(trackStr, sizeof(trackStr), "%s's cellphone signal points to %s.", PlayerICName(targetid), zone);
- SendClientMessage(playerid, COLOR_GREY, trackStr);
- FindingID[playerid] = targetid;
- FindTime[playerid] = 1;
- UsedFind[playerid] = gettime();
- FindTimePoints[playerid] = points;
- PlayerInfo[playerid][pDetSkill] ++;
- // Skill has been increased
- if(PlayerInfo[playerid][pDetSkill] == 50)
- SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 2, you now have a 80 second reload time.");
- else if(PlayerInfo[playerid][pDetSkill] == 100)
- SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 3, you now have a 60 second reload time.");
- else if(PlayerInfo[playerid][pDetSkill] == 200)
- SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 4, you now have a 30 second reload time.");
- else if(PlayerInfo[playerid][pDetSkill] == 400)
- SendClientMessage(playerid, COLOR_YELLOW, "* Your Detective Skill is now Level 5, you now have a 20 second reload time.");
- return 1;
- }
- // Called every second
- detective_SecondSync(playerid) {
- if(FindTime[playerid])
- {
- if(FindTime[playerid] == FindTimePoints[playerid])
- {
- PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
- displayCenterHUDInfo(playerid, "~r~Tracker lost signal...", 8);
- FindTime[playerid] = 0;
- FindTimePoints[playerid] = 0;
- new target = FindingID[playerid];
- if(Called911[target] != 0)
- {
- SetAllCopCheckpoint(target);
- }
- else
- {
- SetPlayerToTeamColor(target);
- }
- FindingID[playerid] = 0;
- }
- else
- {
- new trackStr[128];
- format(trackStr, sizeof(trackStr), "~r~Tracker time left: ~w~%i", FindTimePoints[playerid] - FindTime[playerid]);
- displayCenterHUDInfo(playerid, trackStr, 8); //display for 8 seconds
- FindTime[playerid] += 1;
- }
- }
- return 1;
- }
|