[Release][ESX] Rob NPCs

should also probably change the coding to reflect that this money would be black money as well, but that’s just a thought on my teams end

1 Like

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 :slight_smile:

+1 for an nice Script @hypr9xa

This is really a simple Script thanks for sharing and for the idea👌

Nice job, that was fast.

I’ll add it to OP and credit you!

1 Like

That a Nice release man…
Keep it up


:man_dancing:

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?

Perhaps some GTA Natives could do that, something like what GTA Online had with stores.

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?

I’d love to see this updated! Great concept.

1 Like

Any update on this with sending a notification to the police when robbing an NPC?

2 Likes

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?

Thanks for the mod, works great for NPC’s :slight_smile:

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
1 Like

Any Updated on Cops Getting Notified ?

I created a scripted based off of this that uses the TaskHandUp that keeps them standing in one place without having to freeze the entity.

If the NPC is in a car it drives away but you still get the money.

Not sure what you replied… but if it was asking for the script I just released it to github with credit to this script.

I don’t receive any money or items when I rob NPCs, otherwise everything else works.

which version are you using the esx_robnpc or the vRP version ?

i am using ur version i downloaded urs and used it