local Tunnel = module("vrp", "lib/Tunnel") local Proxy = module("vrp", "lib/Proxy") vRPin = {} Tunnel.bindInterface("fp-inventory",vRPin) Proxy.addInterface("fp-inventory",vRPin) INclient = Tunnel.getInterface("fp-inventory","fp-inventory") vRP = Proxy.getInterface("vRP") vRPclient = Tunnel.getInterface("vRP","fp-inventory") GlobalState['disabledInventory'] = false; openInventories = {} Hotbars = {} vTypes = {} local weaponState = {} local throwables = { ["WEAPON_MOLOTOV"] = GetHashKey("WEAPON_MOLOTOV"), ["WEAPON_THERMITE"] = GetHashKey("WEAPON_THERMITE"), ["WEAPON_STICKYBOMB"] = GetHashKey("WEAPON_STICKYBOMB"), ["WEAPON_BZGAS"] = GetHashKey("WEAPON_BZGAS"), ["WEAPON_GRENADE"] = GetHashKey("WEAPON_GRENADE"), ["WEAPON_PIPEBOMB"] = GetHashKey("WEAPON_PIPEBOMB"), } for wep in pairs(throwables) do throwables[GetHashKey(wep)] = wep end AddEventHandler("startProjectileEvent", function(...) local args = {...} print(table.unpack(args)) end) function vRPin.removeThrowable(weap) if not throwables[weap] then return end local player = source local user_id = vRP.getUserId({player}) vRP.tryGetInventoryItem({user_id, weap, 1, false}) end AddEventHandler("onResourceStart", function(x) if x == GetCurrentResourceName() then for _, v in ipairs(GetPlayers()) do local user_id = vRP.getUserId({v}) if user_id then local p = promise.new() exports.oxmysql:scalar("SELECT weaponState FROM vrp_users WHERE id = ?", {user_id}, function(r) p:resolve(r) end) local data = Citizen.Await(p) -- local uData = vRP.getUserData({user_id, "weaponState"}) weaponState[user_id] = json.decode(data or '[]') or {} TriggerClientEvent("vrp-inventory:setWeaponState", v, weaponState[user_id]) end end end end) AddEventHandler("vRP:playerSpawn", function(user_id, player, fs) if not fs then return end exports.oxmysql:scalar("SELECT weaponState FROM vrp_users WHERE id = ?", {user_id}, function(result) weaponState[user_id] = json.decode(result or '[]') or {} TriggerClientEvent("vrp-inventory:setWeaponState", player, weaponState[user_id]) end) end) Citizen.CreateThread(function() Wait(1000) for _, src in pairs(GetPlayers()) do local user_id = vRP.getUserId({src}); if not user_id then return end -- local wData = vRP.getUserData({user_id, "weaponState"}); local p = promise.new() exports.oxmysql:scalar("SELECT weaponState FROM vrp_users WHERE id = ?", {user_id}, function(r) p:resolve(r) end) local data = Citizen.Await(p) TriggerClientEvent("vrp-inventory:setWeaponState", src, json.decode(data or '[]') or {}) end end) local policeWeaps = { "WEAPON_STUNGUN", "WEAPON_FLASHLIGHT", "WEAPON_NIGHTSTICK", "WEAPON_CARBINERIFLE", "WEAPON_PISTOL50", "WEAPON_MILITARYRIFLE", "WEAPON_APPISTOL", "WEAPON_TACTICALRIFLE", "WEAPON_ADVANCEDRIFLE", "WEAPON_SNIPERRIFLE", "policebadge", "WEAPONO_SPECIALCARBINE", "WEAPON_ASSAULTSMG", "WEAPON_PUMPSHOTGUN", } local sponsorWeaps = { "WEAPON_ASSAULTRIFLE", "WEAPON_SMG", "WEAPON_MACHETE", "WEAPON_SPECIALCARBINE", "WEAPON_PUMPSHOTGUN", } local function isWeaponInList(weapon, list) for _, v in ipairs(list) do if v == weapon then return true end end return false end local function sendDiscordLog(title, message) local embed = { { ["color"] = 16753920, -- portocaliu ["title"] = title, ["description"] = message, ["footer"] = { ["text"] = os.date("%d/%m/%Y | %H:%M:%S") } } } PerformHttpRequest("https://discord.com/api/webhooks/1388509905006231552/MmfwFrkbKh2dfD3EjOJOerX2t3fSkJKqSXrOKOI-PTGxLOa_-llInSNUs7RtsNPZeRQ6", function() end, "POST", json.encode({ embeds = embed }), { ["Content-Type"] = "application/json" } ) end function vRPin.requestItemGive(idname, amount) local _source = source local user_id = vRP.getUserId({_source}) local player = vRP.getUserSource({user_id}) if user_id ~= nil then if idname == "id_doc" or idname == "permis_masina" or idname == "policebadge" or idname == "gunpermit_doc" then sendDiscordLog("Item Blocat", "**ID "..user_id.."** a încercat să ofere item-ul blocat `"..idname.."`.") return vRPclient.notify(player, {"Eroare: Nu poti oferi acest item!"}) end if vRP.isUserInFaction({user_id, "Politie"}) and (string.sub(idname,1,7) == "WEAPON_" or string.sub(idname,1,10) == "adrenalina" or string.sub(idname,1,10) == "bandaj_mic" or string.sub(idname,1,10) == "medkit" or string.sub(idname,1,5) == "ammo-" or string.sub(idname,1,10) == "suppressor" or string.sub(idname,1,8) == "lanterna" or string.sub(idname,1,5) == "extended") then sendDiscordLog("Item Factiune - Politie", "**ID "..user_id.."** (Politie) a încercat să ofere `"..idname.."`.") return vRPclient.notify(player, {"Eroare: Nu poti oferi din bunurile factiunii!"}) end if vRP.isUserInFaction({user_id, "Smurd"}) and (string.sub(idname,1,7) == "WEAPON_" or string.sub(idname,1,10) == "bandaj_mic" or string.sub(idname,1,10) == "medkit") then sendDiscordLog("Item Factiune - Smurd", "**ID "..user_id.."** (Smurd) a încercat să ofere `"..idname.."`.") return vRPclient.notify(player, {"Eroare: Nu poti oferi din bunurile factiunii!"}) end if vRP.isUserInFaction({user_id, "Diicot"}) and (string.sub(idname,1,7) == "WEAPON_" or string.sub(idname,1,10) == "adrenalina" or string.sub(idname,1,10) == "bandaj_mic" or string.sub(idname,1,10) == "medkit" or string.sub(idname,1,5) == "ammo-" or string.sub(idname,1,10) == "suppressor" or string.sub(idname,1,8) == "lanterna" or string.sub(idname,1,5) == "extended") then sendDiscordLog("Item Factiune - Diicot", "**ID "..user_id.."** (Diicot) a încercat să ofere `"..idname.."`.") return vRPclient.notify(player, {"Eroare: Nu poti oferi din bunurile factiunii!"}) end vRPclient.getNearestPlayer(player,{1.7},function(nplayer) local nuser_id = vRP.getUserId({nplayer}) if nuser_id ~= nil then local new_weight = vRP.getInventoryWeight({nuser_id}) + vRP.getItemWeight({idname}) * amount if new_weight <= vRP.getInventoryMaxWeight({nuser_id}) then if vRP.tryGetInventoryItem({user_id, idname, amount, true}) then vRP.giveInventoryItem({nuser_id, idname, amount, true}) sendDiscordLog("Item Transfer", "✅ Jucatorul cu **ID: "..user_id.."** i-a oferit lui **ID: "..nuser_id.."** item-ul `"..idname.."` x"..amount ) vRPclient.playAnim(player,{true,{{"mp_common","givetake2_a",1}},false}) vRPclient.playAnim(nplayer,{true,{{"mp_common","givetake2_a",1}},false}) else sendDiscordLog("Item Give Eșuat", "**ID "..user_id.."** nu avea `"..idname.."` x"..amount.." pentru a oferi.") end else vRPclient.notify(player, {"Eroare: Inventarul jucatorului este plin!"}) sendDiscordLog("Inventar Plin", "**ID "..user_id.."** a încercat să ofere `"..idname.."` x"..amount..", dar **ID "..nuser_id.."** are inventarul plin.") end else sendDiscordLog("Fără Țintă", "**ID "..user_id.."** a încercat să ofere `"..idname.."`, dar nu era nimeni în apropiere.") end end) end INclient.loadPlayerInventory(player) end function vRPin.requestItemUse(idname) local player = source local user_id = vRP.getUserId({player}) local choice = vRP.getItemChoices({idname}) if not (choice and user_id) then return end if string.find(idname, "WEAPON_") then if not weaponState[user_id][idname] then weaponState[user_id][idname] = {} end INclient.equipWeapon(player, {idname}) else if not type(choice) == 'table' then return end; if json.encode(choice or {}) == '[]' then return end for key, value in pairs(choice) do if key ~= "Give" and key ~= "Trash" then local cb = value[1] cb(player,key) INclient.loadPlayerInventory(player, {true}) end end end end function vRPin.requestAmmoForItem(weapon) local user_id = vRP.getUserId({source}) if not user_id then return end local ammoItem = Config.Items and Config.Items[weapon] and Config.Items[weapon][5] if not ammoItem then return end local maxAmmo = math.min(vRP.getInventoryItemAmount({user_id, ammoItem}) or 0, 300) return maxAmmo end function vRPin.requestReload(weapon, ammo) local user_id = vRP.getUserId({source}) if user_id then local ammoItem = Config.Items[weapon][5] if ammoItem then local maxAmmo = vRP.getInventoryItemAmount({user_id, ammoItem}) if ammo > maxAmmo then ammo = maxAmmo end -- print(ammo, maxAmmo) if ammo > 0 and vRP.tryGetInventoryItem({user_id, ammoItem, ammo, false}) then if not weaponState[user_id][weapon] then weaponState[user_id][weapon] = {} end weaponState[user_id][weapon].ammo = ammo return true, ammo end if not weaponState[user_id][weapon] then weaponState[user_id][weapon] = {} end weaponState[user_id][weapon].ammo = 0 -- print(":: NO AMMO ::") return false end end end AddEventHandler("vRP:playerLeave", function(user_id) if weaponState[user_id] then exports.oxmysql:execute("UPDATE vrp_users SET weaponState = ? WHERE id = ?", {json.encode(weaponState[user_id]), user_id}) weaponState[user_id] = nil end end) local xxx = { ["Flashlight"] = "lanterna", ["Extended"] = "extended", ["Suppressor"] = "suppressor", ["Grip"] = "grip", ["Scope"] = "scope", } vRPin.removeAttachments = function(w) local player = source local user_id = vRP.getUserId({player}) if not user_id then return end if not weaponState[user_id] then weaponState[user_id] = {} end if not weaponState[user_id][w] then return end INclient.getState(player, {"reset"}, function(x) if weaponState[user_id][w]?.attach then for _, component in pairs(weaponState[user_id][w].attach) do vRP.giveInventoryItem({user_id, xxx[component], 1}) end end weaponState[user_id][w] = nil local ammoItem = Config.Items[string.upper(w)][5] if ammoItem and ((x?.ammo or 0) > 0) then vRP.giveInventoryItem({user_id, ammoItem, x.ammo}) end TriggerClientEvent("vrp-inventory:setWeaponState", player, weaponState[user_id]) end) end vRPin.removeWeapon = function(weapon) local player = source local user_id = vRP.getUserId({player}) if not user_id then return end INclient.getState(player, {"ammo"}, function(x) local ammoItem = Config.Items[string.upper(weapon)][5] if ammoItem and ((x?.ammo or 0) > 0) then vRP.giveInventoryItem({user_id, ammoItem, x.ammo}) end end) end vRP.defInventoryItem({"lanterna", "Lanterna Arma", "Lanterna este folosita pentru a imbunatatii vizibilitatea in momentul folosirii armei de foc pe timp de noapte", function(args) local choices = {} local idname = args[1] choices["Foloseste"] = {function(player,choice) local user_id = vRP.getUserId({player}) if user_id then INclient.getEquipedWeapon(player, {}, function(uWeap) if not uWeap then return vRPclient.notify(player, {"Nu ai nici o arma in mana."}) end if GetHashKey(uWeap) ~= -1569615261 then if vRP.tryGetInventoryItem({user_id, "lanterna", 1, true}) then Citizen.CreateThread(function() if not weaponState[user_id][uWeap] then weaponState[user_id][uWeap] = {} end if not weaponState[user_id][uWeap].attach then weaponState[user_id][uWeap].attach = {} end weaponState[user_id][uWeap].attach[#weaponState[user_id][uWeap].attach+1] = "Flashlight" INclient.addAttachment(player, {"Flashlight"}) end) end else vRPclient.notify(player, {"Eroare: Poti pune acest atasament doar pe o arma!"}) end end) end end} return choices end, 0.1}) vRP.defInventoryItem({"scope", "Tinta Laser", "", function(args) local choices = {} local idname = args[1] choices["Foloseste"] = {function(player,choice) local user_id = vRP.getUserId({player}) if user_id then INclient.getEquipedWeapon(player, {}, function(uWeap) if not uWeap then return vRPclient.notify(player, {"Eroare: Nu ai nici o arma in mana!"}) end if GetHashKey(uWeap) ~= -1569615261 then if vRP.tryGetInventoryItem({user_id, "scope", 1, true}) then -- vRPclient.playAnim(player, {true,{{"mp_arresting","a_uncuff",1}},false}) Citizen.CreateThread(function() if not weaponState[user_id][uWeap] then weaponState[user_id][uWeap] = {} end if not weaponState[user_id][uWeap].attach then weaponState[user_id][uWeap].attach = {} end weaponState[user_id][uWeap].attach[#weaponState[user_id][uWeap].attach+1] = "Scope" INclient.addAttachment(player, {"Scope"}) end) end else vRPclient.notify(player, {"Eroare: Poti pune acest atasament doar pe o arma!"}) end end) end end} return choices end, 0.1}) vRP.defInventoryItem({"grip", "Grip Arma", "", function(args) local choices = {} local idname = args[1] choices["Foloseste"] = {function(player,choice) local user_id = vRP.getUserId({player}) if user_id then INclient.getEquipedWeapon(player, {}, function(uWeap) if not uWeap then return vRPclient.notify(player, {"Eroare: Nu ai nici o arma in mana!"}) end if GetHashKey(uWeap) ~= -1569615261 then if vRP.tryGetInventoryItem({user_id, "grip", 1, true}) then -- vRPclient.playAnim(player, {true,{{"mp_arresting","a_uncuff",1}},false}) Citizen.CreateThread(function() -- Citizen.Wait(1000) if not weaponState[user_id][uWeap] then weaponState[user_id][uWeap] = {} end if not weaponState[user_id][uWeap].attach then weaponState[user_id][uWeap].attach = {} end weaponState[user_id][uWeap].attach[#weaponState[user_id][uWeap].attach+1] = "Grip" INclient.addAttachment(player, {"Grip"}) end) end else vRPclient.notify(player, {"Eroare: Poti pune acest atasament doar pe o arma!"}) end end) end end} return choices end, 0.1}) vRP.defInventoryItem({"suppressor", "Amortizor Arma", "", function(args) local choices = {} local idname = args[1] choices["Foloseste"] = {function(player,choice) local user_id = vRP.getUserId({player}) if user_id then INclient.getEquipedWeapon(player, {}, function(uWeap) if not uWeap then return vRPclient.notify(player, {"Eroare: Nu ai nici o arma in mana"}) end if GetHashKey(uWeap) ~= -1569615261 then if vRP.tryGetInventoryItem({user_id, "suppressor", 1, true}) then -- vRPclient.playAnim(player, {true,{{"mp_arresting","a_uncuff",1}},false}) Citizen.CreateThread(function() -- Citizen.Wait(1000) if not weaponState[user_id][uWeap] then weaponState[user_id][uWeap] = {} end if not weaponState[user_id][uWeap].attach then weaponState[user_id][uWeap].attach = {} end weaponState[user_id][uWeap].attach[#weaponState[user_id][uWeap].attach+1] = "Suppressor" -- print("weapon add", user_id, uWeap) -- print("adaugat", json.encode(weaponState[user_id])) INclient.addAttachment(player, {"Suppressor"}) end) end else vRPclient.notify(player, {"Eroare: Poti pune acest atasament doar pe o arma!"}) end end) end end} return choices end, 0.1}) vRP.defInventoryItem({"extended", "Incarcator Arma", "", function(args) local choices = {} local idname = args[1] choices["Foloseste"] = {function(player,choice) local user_id = vRP.getUserId({player}) if user_id then INclient.getEquipedWeapon(player, {}, function(uWeap) if not uWeap then return vRPclient.notify(player, {"Eroare: Nu ai nici o arma in mana!"}) end if GetHashKey(uWeap) ~= -1569615261 then if vRP.tryGetInventoryItem({user_id, "extended", 1, true}) then -- vRPclient.playAnim(player, {true,{{"mp_arresting","a_uncuff",1}},false}) Citizen.CreateThread(function() -- Citizen.Wait(1000) if not weaponState[user_id][uWeap] then weaponState[user_id][uWeap] = {} end if not weaponState[user_id][uWeap].attach then weaponState[user_id][uWeap].attach = {} end weaponState[user_id][uWeap].attach[#weaponState[user_id][uWeap].attach+1] = "Extended" INclient.addAttachment(player, {"Extended"}) end) end else vRPclient.notify(player, {"Eroare: Poti pune acest atasament doar pe o arma!"}) end end) end end} return choices end, 0.1}) exports("resetHotbars",function(user_id) if not user_id then return end; if not Hotbars[user_id] then Hotbars[user_id] = {} end; Hotbars[user_id] = {}; weaponState[user_id] = {} end) -- RegisterServerEvent('resetHotbars') function vRPin.requestPutHotbar(idname, amount, slot, from) local user_id = vRP.getUserId({source}) local player = vRP.getUserSource({user_id}) if user_id ~= nil then if from ~= nil then Hotbars[user_id][from] = nil end Hotbars[user_id][slot] = idname INclient.loadPlayerInventory(player) end end function vRPin.requestRemoveHotbar(slot) local user_id = vRP.getUserId({source}) local player = vRP.getUserSource({user_id}) if user_id ~= nil then Hotbars[user_id][slot] = nil INclient.loadPlayerInventory(player) end end AddEventHandler("vRP:playerLeave", function(user_id, _, fs) if not fs then Hotbars[user_id] = nil end end) function vRPin.useHotbarItem(slot) local player = source local user_id = vRP.getUserId({player}) if user_id ~= nil and Hotbars[user_id] ~= nil then local idname = Hotbars[user_id][slot] if idname ~= nil then vRPin.requestItemUse(idname) local amount = vRP.getInventoryItemAmount({user_id,idname}) if amount < 1 then Hotbars[user_id][slot] = nil end end end end function vRPin.getHotbarItems(player) local user_id = vRP.getUserId({player}) if user_id ~= nil then local hotbarItems = {} if Hotbars[user_id] ~= nil then for slot, idname in pairs(Hotbars[user_id]) do local item_name, description = vRP.getItemDefinition({idname}) local amount = vRP.getInventoryItemAmount({user_id,idname}) if amount > 0 then hotbarItems[#hotbarItems+1] = { label = item_name, count = amount, description = description, name = idname, slot = slot } end end end return hotbarItems end end local portoafa = { ["portarma"] = { label = "Permis Port Arma", count = 1, description = "Permisul tau port arma personal.", name = "portarma", }; ["permis"] = { label = "Permis Auto", count = 1, description = "", name = "permis", }; } function vRPin.getBuzunarData() local player = source local user_id = vRP.getUserId({player}) if user_id then local data = vRP.getUserDataTable({user_id}) local dataTable = {} if data and data.inventory then -- dataTable[#dataTable+1] = {} table.insert(dataTable, { label = "Buletin", count = 1, description = "Buletin-ul tau personal.", name = "Buletin", }) -- print(json.encode(data.licenses)) if data.licenses then for idname in pairs(data.licenses) do if portoafa[idname] then table.insert(dataTable, portoafa[idname]) end end end return dataTable end end end function vRPin.closeInventory(type) local player = source local user_id = vRP.getUserId({player}) if not user_id then return end -- print(type,user_id) if type == "trunk" or type == "glovebox" then vRPclient.stopAnim(player, {false}) if vTypes[user_id] ~= nil then vRPclient.vc_closeDoor(vTypes[user_id][1], {vTypes[user_id][2],5}) vTypes[user_id] = nil end end openInventories[user_id] = nil end function vRPin.inventoryOpened(player) local user_id = vRP.getUserId({player}) if user_id ~= nil then vRPclient.getNearestOwnedVehicle(player,{3.5},function(ok,vtype,name) if ok then INclient.isIsideACar(player, {}, function(inside) if inside then openGlovebox(player, user_id, user_id, name) return else openTrunk(player, user_id, user_id, name, vtype) return end end) else INclient.openInventory(player, {"drop"}) end end) INclient.openInventory(player, {'normal'}) end end local function sendVehicleLog(title, description, color) local embed = { { title = title, description = description, color = color or 3447003, timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ"), footer = { text = "Vehicle Logs" } } } PerformHttpRequest("https://discord.com/api/webhooks/1388501182087168011/oorQr4YDQmoI-3ZAPqDTtimXEw-LrueG06brPeZ6xSlYn5SHJ8YV_6NDxrfI0B0kBNPp", function() end, "POST", json.encode({embeds = embed}), {["Content-Type"] = "application/json"} ) end local function sendMoneyLog(title, description, color) local embed = { { title = title, description = description, color = color or 3447003, timestamp = os.date("!%Y-%m-%dT%H:%M:%SZ"), footer = { text = "Money Logs" } } } PerformHttpRequest("https://discord.com/api/webhooks/1388501858653306951/bCRHhniPrdWO9mCQhTPfre1hFgvQdBOVzx4MUP73C89bB5rOXilyVnYF_CNudzH4zXmi", function() end, "POST", json.encode({embeds = embed}), {["Content-Type"] = "application/json"} ) end vRP.registerMenuBuilder({"main", function(add, data) local user_id = vRP.getUserId({data.player}) if user_id ~= nil then local choices = {} choices["CERE ACCES LA PORTBAGAJ"] = { function(player, choice) vRPclient.getNearestPlayer(player, { 3 }, function(nplayer) local nuser_id = vRP.getUserId({ nplayer }) if nuser_id ~= nil then sendVehicleLog( "Cerere Acces Portbagaj", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Status:** Cerere trimisa", 16776960 ) TriggerClientEvent('fpt:notify',player, "inform","Intreaba...") vRP.request({ nplayer, "Vrei sa deschizi portbagajul ?", 15, function(nplayer, ok) if ok then vRPclient.getNearestOwnedVehicle(nplayer, { 6 }, function(ok, vtype, name) if ok then sendVehicleLog( "Acces Portbagaj Acordat", "**Jucator:** " .. user_id .. "\n**Proprietar:** " .. nuser_id .. "\n**Vehicul:** " .. name .. "\n**Tip:** " .. vtype, 65280 ) openTrunk(player, user_id, nuser_id, name, vtype, "nutragemiteme") else sendVehicleLog( "Eroare Portbagaj", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Eroare:** Nici un vehicul prin preajma", 16711680 ) TriggerClientEvent("fpt:notify",player, "error", "Nici un vehicul prin preajma.") TriggerClientEvent("fpt:notify",nplayer, "error", "Nici un vehicul prin preajma.") end end) else sendVehicleLog( "Acces Portbagaj Refuzat", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Status:** Cerere refuzata", 16711680 ) TriggerClientEvent("fpt:notify",player, "inform", "Cerere refuzata!") end end }) else sendVehicleLog( "Eroare Portbagaj", "**Jucator:** " .. user_id .. "\n**Eroare:** Nici o persoana prin preajma", 16711680 ) TriggerClientEvent("fpt:notify",player, "error", "Nici o persoana prin preajma!") end end) end } add(choices) end end }) vRP.registerMenuBuilder({"main", function(add, data) local user_id = vRP.getUserId({data.player}) if user_id ~= nil then local choices = {} choices["CERE ACCES LA TORPEDOU"] = { function(player, choice) vRPclient.getNearestPlayer(player, { 3 }, function(nplayer) local nuser_id = vRP.getUserId({ nplayer }) if nuser_id ~= nil then sendVehicleLog( "Cerere Acces Torpedou", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Status:** Cerere trimisa", 16776960 ) TriggerClientEvent('fpt:notify',player, "inform","Intreaba...") vRP.request({ nplayer, "Vrei sa deschizi torpedoul ?", 15, function(nplayer, ok) if ok then vRPclient.getNearestOwnedVehicle(nplayer, { 6 }, function(ok, vtype, name) if ok then sendVehicleLog( "Acces Torpedou Acordat", "**Jucator:** " .. user_id .. "\n**Proprietar:** " .. nuser_id .. "\n**Vehicul:** " .. name, 65280 ) openGlovebox(player, user_id, nuser_id, name, "nutragemiteme") else sendVehicleLog( "Eroare Torpedou", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Eroare:** Nici un vehicul prin preajma", 16711680 ) TriggerClientEvent("fpt:notify",player, "error", "Nici un vehicul prin preajma.") TriggerClientEvent("fpt:notify",nplayer, "error", "Nici un vehicul prin preajma.") end end) else sendVehicleLog( "Acces Torpedou Refuzat", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Status:** Cerere refuzata", 16711680 ) TriggerClientEvent("fpt:notify",player, "inform", "Cerere refuzata!") end end }) else sendVehicleLog( "Eroare Torpedou", "**Jucator:** " .. user_id .. "\n**Eroare:** Nici o persoana prin preajma", 16711680 ) TriggerClientEvent("fpt:notify",player, "error", "Nici o persoana prin preajma!") end end) end } add(choices) end end }) RegisterServerEvent('sxint$oferaBani',function() local player = source local user_id = vRP.getUserId({player}) if user_id then vRPclient.getNearestPlayer(player,{1.7},function(nplayer) if nplayer ~= nil then local nuser_id = vRP.getUserId({nplayer}) if nuser_id ~= nil then vRP.prompt({player,"Ofera bani","",function(_, amount) local amount = parseInt(amount) sendMoneyLog( "Incercare Oferire Bani", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Suma:** $" .. amount, 16776960 ) if amount > 5000 then sendMoneyLog( "Eroare Oferire Bani", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Suma:** $" .. amount .. "\n**Eroare:** Suma prea mare (max $5000)", 16711680 ) return vRPclient.notify(player, {"Nu poti oferi mai mult de $5000 cash!"}) end if amount > 0 and vRP.tryPayment({user_id,amount}) then vRP.giveMoney({nuser_id,amount}) vRPclient.notify(player,{"Ai oferit $"..vRP.formatMoney{amount}}) vRPclient.notify(nplayer,{"Ai primit: $"..vRP.formatMoney{amount}}) sendMoneyLog( "Transfer Bani Reusit", "**Donator:** " .. user_id .. "\n**Beneficiar:** " .. nuser_id .. "\n**Suma:** $" .. vRP.formatMoney{amount}, 65280 ) vRP.sendToDiscord({ "oferbani", "Jucatorul cu id: [" .. user_id .. "] a oferit suma de $" .. amount .. " jucatorului cu id: [" .. nuser_id .. "]." }) else sendMoneyLog( "Eroare Oferire Bani", "**Jucator:** " .. user_id .. "\n**Tinta:** " .. nuser_id .. "\n**Suma:** $" .. amount .. "\n**Eroare:** Fonduri insuficiente", 16711680 ) vRPclient.notify(player,{"Eroare: Nu ai bani suficienti!"}) end end}) else sendMoneyLog( "Eroare Oferire Bani", "**Jucator:** " .. user_id .. "\n**Eroare:** ID jucator tinta invalid", 16711680 ) vRPclient.notify(player,{"Eroare: Nici un jucator in jurul tau!"}) end else sendMoneyLog( "Eroare Oferire Bani", "**Jucator:** " .. user_id .. "\n**Eroare:** Nici un jucator in preajma", 16711680 ) vRPclient.notify(player,{"Eroare: Nici un jucator in jurul tau!"}) end end) end end) function vRPin.getInventoryItems(player) local user_id = vRP.getUserId({player}) local data = vRP.getUserDataTable({user_id}) local weight = vRP.getInventoryWeight({user_id}) local max_weight = vRP.getInventoryMaxWeight({user_id}) local items = {} local hotbarItems = {} if Hotbars[user_id] == nil then Hotbars[user_id] = {} end if not data then data = {} end; if not data.inventory then data.inventory = {} end; for k,v in pairs(data.inventory) do local item_name, description, weight = vRP.getItemDefinition({k}) local found = false if item_name ~= nil then for slot, idname in pairs(Hotbars[user_id]) do if idname == k then found = true hotbarItems[#hotbarItems+1] = { label = item_name, count = v.amount, description = description, name = idname, weight = weight, slot = slot } end end if not found then items[#items+1] = { label = item_name, count = v.amount, description = description, weight = weight, name = k } end end ::skip:: end return items, hotbarItems, weight, max_weight end function vRPin.getAllInventoryItems(player) local player = player local user_id = vRP.getUserId{player} if not user_id then return end local data = vRP.getUserDataTable({user_id}) local weight = vRP.getInventoryWeight({user_id}) local max_weight = vRP.getInventoryMaxWeight({user_id}) local items = {} for k,v in pairs(data.inventory) do local item_name, description, weight = vRP.getItemDefinition({k}) if item_name then items[#items+1] = { label = item_name, count = v.amount, description = description, weight = weight, name = k } end end return items, weight, max_weight end -- Define items CreateThread(function() for k,v in pairs(Config.Items or {}) do vRP.defInventoryItem({k,v[1],v[2],false,v[4]}) end end)