Skip to content

Commit

Permalink
add fourth mission
Browse files Browse the repository at this point in the history
  • Loading branch information
lfuelling committed May 6, 2020
1 parent cd0f3d8 commit b3b5eae
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
60 changes: 60 additions & 0 deletions client/missions/mission4.lua
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ client_scripts {
'client/missions/mission1.lua',
'client/missions/mission2.lua',
'client/missions/mission3.lua',
'client/missions/mission4.lua',
}

server_scripts {
Expand Down
6 changes: 6 additions & 0 deletions locales/en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
}

0 comments on commit b3b5eae

Please sign in to comment.