[Release] esx_merryweather robbery

They will be hostile to everyone who aims a gun at them, so I figured if they have a group of people trying to do the robbery and they’re all firing, the peds will still fire at any player that aims at them

yeh im with you, but you can actually have the person that starts it stay in the room and have others go round punching them to death.

1 Like

When i rob the merryweather i dont get the reward for some weird reason, can somebody help me solve it

make sure you have items reward on database, see the items reward on server.lua, you can change items reward as you want in server.lua, just make sure items available on database.

than when mission started, just stay on location, kill all enemy approaching until timeout and you will get reward.

this script work well on my server.

I get the specified items from the client/main.lua, but i do not get the black money reward from the config reward = math.random(200000,350000),

The config math random reward is basically null, due to me removing that aspect of the rewards within the server lua file. If you navigate to the server lua file and search for chance you’ll see where the items are rewarded and the xPlayer.addAccountMoney('black_money', #####)

Ok, and how can i get the black money reward with the item rewards?

anyway of making it cancel robbing if the player dies?

bro is this updated to work with the new esx?

Yes it is. No essentialmode required.

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(1)
		local playerPos = GetEntityCoords(PlayerPedId(), true)
		local ped = PlayerPedId()

		for k,v in pairs(Stores) do
			local storePos = v.position
			local distance = Vdist(playerPos.x, playerPos.y, playerPos.z, storePos.x, storePos.y, storePos.z)

			if distance < Config.Marker.DrawDistance then
				if not holdingUp then
					DrawMarker(Config.Marker.Type, storePos.x, storePos.y, storePos.z - 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Config.Marker.x, Config.Marker.y, Config.Marker.z, Config.Marker.r, Config.Marker.g, Config.Marker.b, Config.Marker.a, false, false, 2, false, false, false, false)

					if distance < 0.5 then
						ESX.ShowHelpNotification(_U('press_to_rob', v.nameOfStore))

						if IsControlJustReleased(0, 38) and IsPedArmed(ped, 6) and not IsEntityDead(ped) then
							TriggerServerEvent('esx_customrob:robberyStarted', k)
						end
					end
				end
			end
		end

if you change your client section to this it won’t let them start without a gun, in case anybody else wanted it. still trying to get a death check on the reward if anyone has added that?

Love this! Is there anyway to shorten the robbery? I want to make it less than 1000. I feel if I just adjust the time in the config file it will mess with the timing of the ped spawning.

sry, can u tell me name of your status ui ?

how to set
if player is die then cancel the rob

Try running a loop with the IsEntityDead native and cancelling the robbery when it returns true?

Citizen.CreateThread(function()
	while true do
		if holdingUp then
			if IsEntityDead(GetPlayerPed(-1)) then
				holdingUp, store = false, ''
				exports['mythic_notify']:DoHudText('inform', 'Robbery was cancelled')
			else
				Citizen.Wait(10000)
			end
		end
		Citizen.Wait(10)
	end
end)

its so good,thanks you

1 Like

sry, this code made sv dump .

goto
esx_merryweather\client\main.lua

find line :
if Vdist(playerPos.x, playerPos.y, playerPos.z, storePos.x, storePos.y, storePos.z) > Config.MaxDistance then
add into it :
if Vdist(playerPos.x, playerPos.y, playerPos.z, storePos.x, storePos.y, storePos.z) > Config.MaxDistance or IsEntityDead(PlayerPedId()) then

does anyone know how to get this to cancel on player death. i tried everything. the esx_customrob2:robberyStarted event wont stop. the timer indication stops but once it runs it still gives the player the reward

fixed it, change
AddEventHandler(‘esx:onPlayerDeath’, function(data)

holdingUp, store = false, ''

end)

To

AddEventHandler(‘esx:onPlayerDeath’, function(data)

holdingUp, store = false, ''

TriggerServerEvent('esx_customrob:tooFar', store)

end)

is there any way to add an alert to the police??