This is as simple as it reads, all you got to do is download the script, place it into your resources folder and add it to your server.cfg file by writing start esx_robnpc anywhere you find.
VRP :)) vrp_robnpc.rar (17.2 KB)
I’ve have added so your freezetime is not 10 Seconds, it looks dum when the NPC hold hear hands up for 10 Seconds and running with hear legs, but cant go anywhere, because the Entity is Freezed.
So its changed to 1
Take a look at the stasiek selldrugs script. It works well with esx police interaction. The dealer only knows that his advances were refused and the NPC randomly notifies police. It works really well actually.
I put the esx Rob NPCs
I have Npc rendered, but checked in my portfolio and I do not receive $,
Is there anything else for him to repay me in addition to aim and squeeze and to render him?
If you added notifications that sent to the police officers then can you please add a limitation? I mean, you can rob the people only if there are 3 police officers on the server or can you add a limitation that you can rob again after maybe 300 seconds?
Just implamented on a server, I was able to rob a player using this system, do you know if there’s anything in the code that I can change so players can’t be robbed too?
Not sure if this will help someone or not and I am not really good at coding but here is some fixes that will make them sit in place while your rob them and not run in place like before:
function robNpc(targetPed)
robbedRecently = true
Citizen.CreateThread(function()
local dict = 'mp_am_hold_up'
RequestAnimDict(dict)
while not HasAnimDictLoaded(dict) do
Citizen.Wait(10)
end
SetEveryoneIgnorePlayer(PlayerId(), true)
TaskStandStill(targetPed, Config.RobAnimationSeconds * 1000)
--FreezeEntityPosition(targetPed, true)
SetBlockingOfNonTemporaryEvents(targetPed, true)
TaskPlayAnim(targetPed, dict, 'cower_loop', 8.0, -8, 15000.0, 49, 0, 0, 0, 0)
FreezeEntityPosition(targetPed, true)
robbed = true
ESX.ShowNotification(_U('robbery_started'))
Citizen.Wait(Config.RobAnimationSeconds * 1000)
ESX.TriggerServerCallback('esx_robnpc:giveMoney', function(amount)
FreezeEntityPosition(targetPed, false)
ESX.ShowNotification(_U('robbery_completed', amount))
end)
if Config.ShouldWaitBetweenRobbing then
Citizen.Wait(math.random(Config.MinWaitSeconds, Config.MaxWaitSeconds) * 1000)
ESX.ShowNotification(_U('can_rob_again'))
end
robbedRecently = false
end)
end