Pawn

MrNewbPawn

Pawn shops with optional buy-back of sold stock, plus foundry box zones for smelting. Built on Newb_Bridge.

GitHub · Discord · Installation · Item setup · Item images · Preview

Pawn shop artwork

Requirements

  • Newb_Bridge
  • ox_lib
  • Artifact /server:6116 or newer, OneSync
  • Framework via the bridge (cash)
  • Inventory via the bridge (sell / buy / smelt items)
  • Target via the bridge (shop peds + foundry box zones)

Items are not usable. The script does not register item use. Names in itemlist and MeltableItems must exist in your inventory. Shipped PNGs are in [INSTALL]/images/ (filename = item name).

Where you edit

configs/config.lua.

KeyPurpose
Config.DebugBox-zone debug draw. Debug also waits two seconds on resource start, then rebuilds shops and foundries. Leave false live.
Config.LoggingPrints sell / buy / smelt lines to the server console
Config.PurchaseStockLet players buy items others sold at that shop (true)
Config.PurchaseMarkupBuy-back percent over sell price, rounded up. Shipped 20 means sell $4 → buy $5, sell $8 → buy $10
Config.PawnShopsPed shops: position, model, itemlist, optional Blip / storeHours
Config.FoundryLocationsSmelters: Zone box (coords, size, rotation), optional Blip / lerpProp
Config.MeltableItemsSmelt recipes

Sold stock is a Lua table on each shop (stock). It is gone when the resource restarts.

Shop entry

['Christians Pawn Shop'] = {
    position = vector4(412.5550, 314.4313, 103.0210, 220.8834),
    model = 'a_m_m_farmer_01',
    radius = 100.0,
    Blip = { label = 'Christians Pawn Shop', color = 50, sprite = 500, scale = 0.8 },
    itemlist = { metalscrap = 8, rolex = 140 },
},

Shipped shops omit storeHours (always open). Positions:

Shopposition
Christians Pawn Shopvector4(412.5550, 314.4313, 103.0210, 220.8834)
Stretchs Pawn Shopvector4(183.1389, -1319.7739, 29.3186, 246.9986)
Robbies Pawn Shopvector4(-1459.8115, -413.8209, 35.7551, 178.0825)
FieldPurpose
positionPed spawn (vector4)
modelPed model
radiusAddInteraction spawn radius (default 100.0)
BlipOptional map blip
itemlistItem name → sell price (cash)
storeHoursOptional { open, close } using in-game GetClockHours() (023)

No storeHours (or open == close) = always open. open < close is a same-day window. open > close wraps midnight. Both hours are inclusive. Closed shops notify and skip the menu. Hours are client-only.

Buy-back

When Config.PurchaseStock is true, each sale adds that count to shop.stock[item]. Buy price is math.ceil(sellPrice * (100 + PurchaseMarkup) / 100) from the live config (integer cash never rounds a 20% markup back down to the sell price). Players pay cash. Empty stock hides the buy list.

Foundry entry (target box zone)

Client registers bridge.target.addBoxZone from Zone. The server only checks distance from Zone.coords (within 10.0).

Foundry = {
    Zone = {
        coords = vector3(1086.18, -2003.78, 30.98),
        size = vector3(4.55, 3.00, 3.05),
        rotation = 229.48,
    },
},
Foundry2 = {
    Zone = {
        coords = vector3(1112.93, -2010.13, 32.64),
        size = vector3(4.50, 7.50, 10.50),
        rotation = 236.29,
    },
    Blip = { label = 'Foundry', color = 6, sprite = 436, scale = 0.8 },
    lerpProp = {
        lerpSpeed = 0.25,
        waypoints = {
            vector3(1114.6724, -2011.4340, 34.8549),
            vector3(1112.0618, -2009.6460, 34.8549),
            vector3(1112.0618, -2009.6460, 32.7968),
        },
    },
},
FieldPurpose
Zone.coordsBox center (vector3). Server distance check uses this
Zone.sizeBox size (vector3) for the target zone
Zone.rotationBox heading
BlipOptional; uses Zone.coords
lerpPropOptional local prop that travels waypoints during the progress bar

Smelt recipe

Config.MeltableItems = {
    metalscrap = {
        prop = 'prop_rub_scrap_06',
        rewards = {
            { itemName = 'iron', count = 1 },
        },
    },
    rolex = {
        rewards = {
            { itemName = 'gold', count = 1 },
            { itemName = 'metalscrap', count = 1 },
        },
    },
}

Shipped inputs: metalscrap, diamond_ring, goldchain, rolex.

FieldPurpose
propModel for lerpProp (default prop_cs_cardbox_01)
rewardsArray of { itemName, count } per input item. Counts multiply by the batch size

If rewards is missing but the entry is an array (entry[1]), that array is treated as the recipe (legacy shape).

Server batch cap is 50. Progress is amount * 1000 ms, capped at 30s, or the lerp travel time if that is longer.

Items

Not usable. Skip names you already have; copy PNGs if you want this art.

ItemLabel
metalscrapMetal Scrap
ironIron
steelSteel
copperCopper
aluminumAluminum
plasticPlastic
glassGlass
rubberRubber
radioRadio
phonePhone
laptopLaptop
rolexGolden Watch
goldchainGolden Chain
diamond_ringDiamond Ring
sapphire_ringSapphire Ring
emerald_necklaceEmerald Necklace
ruby_ringRuby Ring
diamond_necklaceDiamond Necklace
goldGold Bar
diamondDiamond

Paste: Item setup. Gallery: Item images.

metalscrap iron steel copper aluminum plastic glass rubber radio phone laptop rolex goldchain diamond_ring sapphire_ring emerald_necklace ruby_ring diamond_necklace gold diamond

Layout

PathRole
configs/config.luaShops, markup, foundry boxes, recipes
resource/client/shops.luaPeds, blips, sell / buy menus
resource/client/foundry.luaTarget box zones, melt menu, lerp prop
resource/client/debug.luaDebug rebuild on resource start
resource/server/shops.luaSell / buy; distance 6.0 from shop position
resource/server/foundry.luaSmelt; distance 10.0 from Zone.coords
[INSTALL]/images/Item PNGs

Player flows

Sell — target the ped, pick an itemlist row, choose a count (max 100), 3s progress + handoff anim, cash payout. Server requires within 6.0 of position.

Buy pawned stock — only if PurchaseStock. Fetches that shop’s in-memory stock, pays cash, subtracts count. Same 6.0 check.

Smelt — target the foundry box zone, pick a recipe, choose a count (max 50), progress, input removed and rewards added (counts × batch). Server requires within 10.0 of Zone.coords.

No exports and no commands.