diff --git a/client/main.lua b/client/main.lua index e402de0..fa467b5 100644 --- a/client/main.lua +++ b/client/main.lua @@ -83,6 +83,8 @@ Citizen.CreateThread(function() _secondMissionLogic() elseif isInThirdMission() and timeForNextMission() then _thirdMissionLogic() + elseif isInFourthMission() and timeForNextMission() then + _fourthMissionLogic() else Citizen.Wait(20000) -- wait 20 secs end diff --git a/client/missions/mission4.lua b/client/missions/mission4.lua new file mode 100644 index 0000000..403984b --- /dev/null +++ b/client/missions/mission4.lua @@ -0,0 +1,60 @@ +local numberAdded = false +local fourthMissionDone = false +local fourthMissionStarted = false +local fourthMissionIntroDone = false + +--- Event handler for messages sent to the blocked contact (fourth mission) +RegisterNetEvent(eventNamespace .. blockedContact.namespace) +AddEventHandler(eventNamespace .. blockedContact.namespace, function(anon, message) + if isInFourthMission() then + local responseMsg = "" + if anon then + responseMsg = responseMsg .. _U('intro_msg_text_anon_obv') + end + if message == Locations.Bank.BackOfficePc1.machine.user then + completeFourthMission() + fourthMissionDone = true; + else + ESX.ShowAdvancedNotification(blockedContact.name, _U('mission_4_msg_subtitle_re'), -- title, subtitle + responseMsg .. _U('mission_4_msg_text_fail'), -- message + "CHAR_BLOCKED", 1) -- contact photo, symbol + end + end +end) + +function _fourthMissionLogic() + if (not numberAdded and not fourthMissionDone) then + if not fourthMissionStarted then + TriggerEvent('esx_phone:addSpecialContact', blockedContact.name, blockedContact.number, blockedContact.base64Icon) + numberAdded = true + fourthMissionStarted = true + elseif fourthMissionStarted then + TriggerEvent('esx_phone:addSpecialContact', blockedContact.name, blockedContact.number, blockedContact.base64Icon) + numberAdded = true + end + end + if fourthMissionStarted and not fourthMissionDone and not fourthMissionIntroDone then + ESX.ShowAdvancedNotification(blockedContact.name, _U('mission_4_msg_subtitle'), -- title, subtitle + _U('mission_4_msg_text_start'), -- message + "CHAR_BLOCKED", 1) -- contact photo, symbol + fourthMissionIntroDone = true + end +end + +--- Completes the third mission and advances the job rank +function completeFourthMission() + ESX.ShowAdvancedNotification(blockedContact.name, _U('mission_4_msg_subtitle_re'), -- title, subtitle + responseMsg .. _U('mission_4_msg_text_final'), -- message + "CHAR_BLOCKED", 1) -- contact photo, symbol + Citizen.Wait(1500) + TriggerServerEvent(eventNamespace .. "advJob", 4) + Citizen.Wait(1500) + TriggerEvent('esx_phone:removeSpecialContact', blockedContact.number) + TriggerEvent(eventNamespace .. "getNextTriggerTime") +end + +--- Checks if player is in fourth mission. +-- @return true if job is hacker and rank is 3 +function isInFourthMission() + return isHacker() and ESX.GetPlayerData().job.grade_name == 'pentester' +end diff --git a/fxmanifest.lua b/fxmanifest.lua index a01051e..6109fbd 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -35,6 +35,7 @@ client_scripts { 'client/missions/mission1.lua', 'client/missions/mission2.lua', 'client/missions/mission3.lua', + 'client/missions/mission4.lua', } server_scripts { diff --git a/locales/en.lua b/locales/en.lua index 59df469..fb59aa2 100644 --- a/locales/en.lua +++ b/locales/en.lua @@ -46,4 +46,10 @@ Locales['en'] = { ['mission_3_msg_subtitle'] = "Pacific Standard", ['mission_3_msg_subtitle_re'] = "Re: Pacific Standard", ['mission_3_msg_text_start'] = "Hi there. I heard that you know your way around computers. I want to spy the vault combination of the Pacific Standard by using the microphone of a PC nearby. To allow my worm to find the correct host, I need the IP address. GO!", + + ['mission_4_msg_text_final'] = "Great, I didn't expect this to work!", + ['mission_4_msg_text_fail'] = "Nope, that one didn't work...", + ['mission_4_msg_subtitle'] = "Free Real Estate", + ['mission_4_msg_subtitle_re'] = "Re: Free Real Estate", + ['mission_4_msg_text_start'] = "When I was at the bank for consultation a few weeks back, I noticed that an employee can simply change the price of anything the bank sells. I want this nice house, you know what I'm planning. I managed to memorize the password, but I don't know the username to log into the computer remotely. I only know the PC had the number '1-1-1' labelled on it.", }