[FREE][QBCore] ik-illegalweapon scratch serial or buy scratched weapon

ik-illegalweapon

Illegal weapon shop where you can scratch the serialnumber of your gun or buy a gun with scratched serialnumber.

Features:

  • Easy to setup items
  • Random or fixed locations (when random, location changes after each script restart)
  • Localisation: Translated to languages ; English and Dutch (feel free to translate and send PR)
  • Ability to use black money (markedbills or other itemname) as payment method
  • When using the blackmoney option, you can add a multiplier to the price if you want to sell items for more when paid by blackmoney.
  • Ability to open the shop with a configured item
  • Use a custom scratchprice
  • Use an item to scratch the serial numbers
  • Option to remove the item when scratched

Download:

:gun: ik-illegalweapon

Other Resources:

:leaves: ik-weed

:razor: ik-coke

:small_airplane: ik-drugrunner

:blue_car: ik-carplate

:fishing_pole_and_fish: ik-fishing

:police_car: ik-jobgarage

:man_detective: ik-blackmarket

:construction_worker_man: qb-jobmenu

Code is accessible Yes
Subscription-based No
Lines (approximately) 300+
Requirements qb-target / qb-menu
Support Yes
6 Likes

Looks Good

ESX? <3 lol would be awesome.

Some of the functions won’t work on esx.
Like the metadata on the item, unless you have qbtoesx inventory or something like that which supports metadata on items.

i changed ther mark bills to my dirty money item but when i go buy my dirtymoney doesnt get tookin

also when the ped spwans it spawns with like multiple cars is there any way i can turn the car oof and have it like ur black market

You need to edit the lines from 41-56 in client.lua for this.
It’s creating a car, gets the location of the trunk and spawns a ped relative to that position.
You need to remove the vehicle part and let only the ped spawn at the vehicle spawn point, so you need to change the ped position.

Change this:

QBCore.Functions.SpawnVehicle(v.car, function(veh)
            DealerVehicle[k] = veh
            ToggleDoor(DealerVehicle[k],2)
            ToggleDoor(DealerVehicle[k],3)
            Citizen.Wait(2000)
            trunkpos = GetWorldPositionOfEntityBone(DealerVehicle[k], 2)
            print(trunkpos)
            if not props[k] then props[k] = CreateObject(90805875, v["coords"][m].x, v["coords"][m].y, v["coords"][m].z, false, true, true) end
            AttachEntityToEntity(props[k], DealerVehicle[k], 2, 0, 1.0, 0.5, 0.0, 0.0, 90.0, true, true, false, true, 1, true)
            RequestModel(v["model"][i]) while not HasModelLoaded(v["model"][i]) do Wait(0) end
            if peds[k] == nil then peds[k] = CreatePed(0, v["model"][i], trunkpos.x+0.2, trunkpos.y+0.9, trunkpos.z-0.6, v["coords"][m].a-170, false, false) end
            SetEntityInvincible(peds[k], true)
            SetBlockingOfNonTemporaryEvents(peds[k], true)
            FreezeEntityPosition(peds[k], true)
            SetEntityNoCollisionEntity(peds[k], PlayerPedId(), false)
        end, v.coords[m], true)

With this:

        RequestModel(v["model"][i]) while not HasModelLoaded(v["model"][i]) do Wait(0) end
        if peds[k] == nil then peds[k] = CreatePed(0, v["model"][i], v.coords[m].x, v.coords[m].y, v.coords[m].z, v.coords[m].a, false, false) end
        SetEntityInvincible(peds[k], true)
        SetBlockingOfNonTemporaryEvents(peds[k], true)
        FreezeEntityPosition(peds[k], true)
        SetEntityNoCollisionEntity(peds[k], PlayerPedId(), false)
1 Like

ok just changed bouta test out now

i got this error

Can you send a pm?
I’ll help you from there to keep here clean.

1 Like

I’m getting the same error as WhitfieldChicken

Have you checked your locations inside config file for any errors / typo’s ?
It looks like the vector3 value is not correct.

In the config its a vector4, so should i change the vector3 to a vector4 in the client.lua or change it from a vector4 to a vector3 in the config.lua?

client.lua

config.lua

All the errors are fixed in the new version. Update your resource and you’ll have no problems anymore.

Tnx for the fix bro, great script btw

I like it.weapons dont pop up for sale unfortunately tho. Would love to see an update!

I use qbcore and was able to add back the vehicle, waiting animation, and prop on ground.
Made the license plate say BLACK and made sure the van cant be stolen.

You will have to adjust your config coords to allow space for a van

The only improvement still needed is:
The only issue is a scrial scratch repairs the weapon , so someone that has some sql knowledge should continue impoving it so it can save the weapons damage , then set the same damage amount back to the scratched weapon.

Citizen.CreateThread(function()
    for k, v in pairs(Config.Locations) do
        m = math.random(1, #v["coords"]) -- generate a random coordinate
        if not v["hideblip"] then -- Create blip if set to false
            StoreBlip = AddBlipForCoord(v["coords"][m].x, v["coords"][m].y, v["coords"][m].z)
            SetBlipSprite(StoreBlip, v["blipsprite"])
            SetBlipScale(StoreBlip, 0.7)
            SetBlipDisplay(StoreBlip, 6)
            SetBlipColour(StoreBlip, v["blipcolour"])
            SetBlipAsShortRange(StoreBlip, true)
            BeginTextCommandSetBlipName("STRING")
            AddTextComponentSubstringPlayerName(v["label"])
            EndTextCommandSetBlipName(StoreBlip)
        end

        local i = math.random(1, #v["model"]) -- Get random ped model
        RequestModel(v["model"][i])
        while not HasModelLoaded(v["model"][i]) do
            Wait(0)
        end

        if peds[k] == nil then
            peds[k] = CreatePed(0, v["model"][i], v["coords"][m].x, v["coords"][m].y, v["coords"][m].z - 1, v["coords"][m].a, false, false)
            SetEntityInvincible(peds[k], true)
            SetBlockingOfNonTemporaryEvents(peds[k], true)
            FreezeEntityPosition(peds[k], true)
            SetEntityNoCollisionEntity(peds[k], PlayerPedId(), false)
            TaskStartScenarioInPlace(peds[k], "WORLD_HUMAN_STAND_MOBILE", 0, true) -- Make the ped perform a waiting animation

            local spawnOffset = 3.5 -- Adjust this value to position the vehicle properly next to the ped
            local pedHeading = GetEntityHeading(peds[k])
            local vehicleX = v["coords"][m].x + spawnOffset * math.sin(math.rad(pedHeading))
            local vehicleY = v["coords"][m].y + spawnOffset * math.cos(math.rad(pedHeading))

            local vehicle = CreateVehicle("gburrito", vehicleX, vehicleY, v["coords"][m].z, pedHeading + 120.0, true, false)

            -- Freeze the vehicle
            SetVehicleOnGroundProperly(vehicle)
            FreezeEntityPosition(vehicle, true)

            -- Open the 2 rear doors
            SetVehicleDoorOpen(vehicle, 2, false, false) -- Rear left door
            SetVehicleDoorOpen(vehicle, 3, false, false) -- Rear right door

            -- Set the license plate text to "BLACK"
            SetVehicleNumberPlateText(vehicle, "BLACK")

            -- Spawn the prop with an offset
            local propOffset = -3.8 -- Adjust this value to set the offset distance from the ped
            local propX = v["coords"][m].x - 1.3
            local propY = v["coords"][m].y + 1.0
            local propZ = v["coords"][m].z -1.0   -- Adjust this value to set the prop height appropriately

            local prop = CreateObject(GetHashKey("ex_office_swag_guns04"), propX, propY, propZ, true, true, true) -- Spawn the prop
            table.insert(props, prop) -- Add the prop to the props table for later reference

            -- Print debug messages
            if Config.Debug then
                print("Prop Created behind Van for Shop - ['"..k.."']")
                print("Shop - ['"..k.."']")
            end

            -- Add qb-target circle zone
            if Config.OpenWithItem then
                exports['qb-target']:AddCircleZone("['"..k.."']", vector3(v["coords"][m].x, v["coords"][m].y, v["coords"][m].z), 1.5, { name="['"..k.."']", debugPoly=Config.Debug, useZ=true, },{ options = { { event = "ik-illegalweapon:client:ChoiseMenu", icon = "fas fa-certificate", label = Lang:t("target.browse"), item = Config.ItemName, shoptable = v, name = v["label"],  }, }, distance = 2.0 })
            else
                exports['qb-target']:AddCircleZone("['"..k.."']", vector3(v["coords"][m].x, v["coords"][m].y, v["coords"][m].z), 1.5, { name="['"..k.."']", debugPoly=Config.Debug, useZ=true, },{ options = { { event = "ik-illegalweapon:client:ChoiseMenu", icon = "fas fa-certificate", label = Lang:t("target.browse"), shoptable = v, name = v["label"],  }, }, distance = 2.0 })
            end
        end
    end
end)```