[Release] 'Crackdown' Missions System v3 & GitHub for your own missions

That was a good question And I realized I hadn’t given An overview of the default game mode. Yes there are 55 missions.

What?!?! 55 missions and a way to run it in esx! holy crap!
Question1 : is there a quest hub?
Question2 : How does someone start/choose which mission to run?

I thought i could not get even more excited, i was wrong hype level 101% now.

yes esx support as well.
missions by default are chosen randomly out of the 55, once a mission is done it is removed until all other missions are finished, all this can be turned off/on . When a mission is passed/failed/timedout, there will be a little bit of time before the server starts the next mission.

You can have players jump to the mission safe house at the start of each mission, which acts as a hub for that mission.

There are chat command lines that can start a particular mission, or stop the current one it… i.e. /start Mission21, /stop

Players can also vote to stop a mission and/or start a new mission.
Missions can also be joined to form a campaign for a story mode. Like when you succeed in Mission21, you automatically start the new mission in the campaign that it links to like Mission45 say, if you fail you start back at Mission21 again, if you succeed you go to Mission45 and so on…
The mission called Prelude links to the mission called Heat like this. Since they form a story.

btw, you dont need to have safehouses either, players can be given equipment at mission start say, and then removed at mission end. Also another option is that pickups can be placed that players need to pickup. Which has been used for RP servers say.

I tried with your code. Now there is no more multiple mission at start but there is still no peds and vehicle spawning when missions start :thinking: any idea ?

Hmmn, odd, the server should print out that it found a host there. What happens when you do it with one player? Also any errors in the server or client logs?

the server function being called is sv:getClientWhoIsHostAndStartNextMission
the code is below, do you see printouts in the server console like: “found Host…” and
next mission:…” when the mission starts?
If so then that is good. if not, then all clients are returning false from that client function/event we altered which calls this server event, so its a problem with that client event not returning true for at least one host. Not sure how to fix that, but I gave you some clues. :slight_smile:
So if you see the above printouts (which should only show once each) one client was picked and the client event mt:startnextmission will be called on that client to initialize the mission. This is the important function/event that will spawn peds. it will call either SpawnRandomPed or SpawnPed which spawns the peds.

NOTE, some missions will not spawn peds until a player gets within the mission trigger radius, so that may be happening, get closer to the mission blip to see if they spawn. There is code at the top of the SpawnRandomPed and SpawnPed that will see if MissionTriggerRadius is set for the mission and if any players have crossed it. This could be causing you a problem, but shouldnt You can set MissionTriggerRadius to be huge like 15000.0 or make it nil (to unset it) which should spawn peds right away.

mt:startnextmission then calls the server event “sv:one” which will setup all the other clients with the mission info, “sv:one …” will be in the server console.

So I would put some print commands (as debug text) in mt:startnextmission and SpawnPed and SpawnRandomPed to make sure the code is running in those events/functions. Thats if you dont see any errors in the client or server logs.

RegisterServerEvent("sv:getClientWhoIsHostAndStartNextMission")
AddEventHandler("sv:getClientWhoIsHostAndStartNextMission", function(isHost,newMission)
  local nextmission = getNextMission(MissionName)
  if newMission then 
  
	nextmission = newMission
  end
  print("sv:getClientWhoIsHostAndStartNextMission called")
  if(isHost) then 
		print("found Host:"..source)
		print("next mission:"..nextmission)
		--triggerclient event to start next mission
		TriggerClientEvent("mt:startnextmission", source,nextmission)
   end	
end)

@adrillex
was curious myself, seems like onesync can have issues with spawning NPCs…

and OneSync 'Infinity': how to use it - #12 by d0p3t
Guess try doing +set onesync or +set onesync_enableInfinity 1
on the command line, not in the cfg was recommended, try either one. Other than and my post above Im out of ideas, since I dont use OneSync. Also, not sure if onesync breaks old code that was standard before, that would suck if it did, but it shouldnt.

Also, I would put print statements in various points in SpawnPed and SpawnRandomPed to see that the events are being called from mt:startnextmission and a print statement around the CreatePed native call, to see if that code is being called as well.

Good luck and let me know if you get it working.

Anyone know how to keep it from despawning parked vehicles. Everytime I start the script all the parked vehicles in the world disapear. Kinda makes it hard to steal a vehicle, i’ve looked through all the configs and can’t for the life of me figure out what it calling it. Thank you

in client.lua
remove:

-remove vehicles at military base safe house
Citizen.CreateThread(function()
    local player = PlayerPedId()

    while true do
        RemovePeskyVehicles({x = -2108.16, y = 3275.45, z = 38.73}, 5000.0)
        Citizen.Wait(1)
	end
end)

function RemovePeskyVehicles(player, range)
    local pos = GetEntityCoords(playerPed) 

    RemoveVehiclesFromGeneratorsInArea(
        pos.x - range, pos.y - range, pos.z - range, 
        pos.x + range, pos.y + range, pos.z + range
    );
end
1 Like

That Worked thank you!

@adrillex
experimental ONESYNC support version below. Download the code from github and copy this server.lua over the old server.lua if you are on onesync, let me know if you have any issues with onesync with this file…

server.lua (37.4 KB)

Good work, and thanks for the share. It helped me alot in a very specific problem I was unable to accomplish till this post :slight_smile: Thanks again.

1 Like

Such an awesome script thank you for releasing. I do have one question for anyone that has modified the script at all. I am trying to setup that a player goes to a location where a npc is and when the player is within 3.0m or less from the npc they can press ‘E’ and that will trigger the specific mission/missions for that storyline. I have tried messing around with the trigger mission event to add a IS_CONTROL_JUST_PRESSED instead of it being trigger by a radius but it still auto starts the mission when you get close to the NPC. if anyone has attempted this or may know a solution it would be greatly appreciated thanks.

it shouldnt be too hard to implement, if you havent already.

OK, the invisible enemy problem (in indoor environments) I had to solve by spawning enemy NPCs closer to the players, is indeed a problem/bug with GTAO.
My solution is not perfect… very rarely an invisible enemy will spawn, but much better than happening all the time. Just ‘good’ to know that this is a native problem with GTAO.

Its a speedrunner’s dis of gta5, but I linked to the pertinant part where they talk about the bug.

Where would I add this line to make the missions job specific?
if ESX.PlayerData.job ~= nil and ESX.PlayerData.job.name == ‘police’ then

in client look for functions that contain:

TriggerServerEvent('sv:one

that should help you get started. Its been a long time since I worked on this.

if you can handle this server side place it in sv:one function.

again you will need to test as you go… there are multiple places a mission can start.

1 Like

Hello, why does it look like this? - scoreboard

1 Like

I would asume because you have conflicting resources that also use scoreboard. and/Or change the html fonts/styles that fivem uses for this.

Update to the resource, get the latest from the repo link below:

  1. Fixed invisible peds/planes
    Thanks to @mmethod for reporting this.
    Peds in planes that cant hover and are spawned with no other task than to combat hated enemies (players) will tend to crash when there is no active player within range typically10000m.
    Case being, if a player gets killed which the ped in the plane is tasked to kill, and it cannot find any other players or other enemies within range, it can crash, sometimes leaving the plane and peds intact. For some reason the engine would make these planes and the peds who survived the crash invisible. Added some code in the game loop to check for this and set the visibility to true. This happened whether the the peds were targets (purple blips) or regular enemies (red blips).
    An improvement in the future might be to tag the peds in these types of planes using decor and to re-add the task ‘combat enemies in the area’ in the game loop for the peds when detecting that that task is over.
  2. Mission1 was tweaked a bit to improve the hydra spawn.

is there a way to have this setup like a toggleable mission in freeroam, instead of it’s own gamemode?