[PAID] Iz_bagpick - NPC bag theft

NPC bag theft :

Preview : Iz_Bagpick - Vol de sac PNJ Fivem - YouTube
Tebex : https://iz-shop.tebex.io/package/5519087 (18€)

  • You can steal purses (NPC), only from women, with random item drop (configurable)
  • The bag draw time depends on the npc you have in front (configurable)
  • You have a chance of not succeeding the theft, the npc will knock you out and you won’t be able to steal it anymore, it is possible that he will call the LSPD/Sheriff
  • You cannot rob the same person twice
  • When the successful bag theft, you have it in hand, you can choose to open it directly or leave where you want to open it further

The script is completely unlock, you will be able to make your changes.

Code is accessible Yes
Subscription-based No
Lines (approximately) 400
Requirements ESX
Support Yes

Qbus Version using Mythic Notify and Progress Bars.
Untested.

local stealing = false
local targetPed = nil

local stealingItems = {
    {name = "Money", chance = 50},
    {name = "Jewelry", chance = 30},
    {name = "Smartphone", chance = 20},
}

local function startStealing(ped)
    stealing = true
    targetPed = ped

    local drawTime = math.random(5000, 10000) -- Random draw time between 5 to 10 seconds
    local pedModel = GetEntityModel(ped)
    local pedName = GetLabelText(GetDisplayNameFromVehicleModel(pedModel))

    exports['mythic_notify']:DoHudText('inform', 'You are attempting to steal a purse from ' .. pedName)

    -- Wait for the draw time
    Citizen.Wait(drawTime)

    if IsEntityPlayingAnim(PlayerPedId(), "random@mugging3", "handsup_standing_base", 3) and IsEntityPlayingAnim(targetPed, "random@street_race", "_base", 3) then
        -- Successful theft
        local itemIndex = math.random(1, #stealingItems)
        local item = stealingItems[itemIndex]
        local itemAmount = math.random(1, 3)
        local itemName = itemAmount > 1 and (item.name .. "s") or item.name

        local message = "You successfully stole a purse from " .. pedName .. " containing " .. itemAmount .. " " .. itemName .. "!"
        exports['mythic_notify']:DoHudText('success', message)

        -- Remove the stolen purse from the target ped
        TriggerEvent("inventory:addInventoryItem", "purse", itemAmount, targetPed)

        stealing = false
    else
        -- Failed theft
        exports['mythic_notify']:DoHudText('error', "You failed to steal the purse from " .. pedName)
        stealing = false

        if math.random(1, 100) <= 20 then -- 20% chance of being knocked out and reported to the cops
            TriggerServerEvent("mythic_notify:client:SendAlert", { type = 'error', text = "The person you tried to rob has called the cops!" })
            local pos = GetEntityCoords(PlayerPedId())
            TriggerServerEvent('police:player:targetPlayer', GetPlayerServerId(PlayerId()), pos.x, pos.y, pos.z)
        end
    end
end

local function canSteal(ped)
    local pedType = GetPedType(ped)

    if pedType == 28 or pedType == 29 or pedType == 30 then -- Only female NPCs
        local distance = #(GetEntityCoords(ped) - GetEntityCoords(PlayerPedId()))
        return distance <= 3.0 and not IsPedSittingInAnyVehicle(ped) and not stealing
    end

    return false
end

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)

        if not stealing then
            local ped = GetClosestPed()

            if DoesEntityExist(ped) and canSteal(ped) and not IsPedInCombat(ped, PlayerPedId()) then
                -- Display prompt to start stealing
                exports['progressBars']:startUI(5000, "Preparing to steal...")
                startStealing(ped)
            end
        end
    end
end)
1 Like

Fourth repost