vRPin = {} Tunnel.bindInterface("fp-inventory",vRPin) vRPserver = Tunnel.getInterface("vRP","fp-inventory") INserver = Tunnel.getInterface("fp-inventory","fp-inventory") vRP = Proxy.getInterface("vRP") local isInInventory = false local isInHotbar = false local useDee = 0 eqWeap = {} checkInventory = function() return isInInventory end bypassffa = false RegisterNetEvent("sorinel:ffa") AddEventHandler("sorinel:ffa", function(b) bypassffa = b end) LocalPlayer.state.togInventory = false; RegisterCommand('sorinel:inventory',function() if not bypassffa then if GlobalState['disabledInventory'] then return vRP.notify({"Eroare: Nu poti accesa inventarul in acest moment!"}) end; if LocalPlayer.state.togInventory then return vRP.notify({"Eroare: Nu poti accesa inventarul in acest moment!"}) end; if not vRP.isInComa() and not vRP.isHandcuffed() and (vRP.getHealth({}) > 105) then local playerId = PlayerId() local playerSource = GetPlayerServerId(playerId) INserver.inventoryOpened({playerSource}) end end end) RegisterKeyMapping('sorinel:inventory', 'Open Inventory', 'keyboard', 'I') for i=1, 5 do RegisterCommand('slot' .. i,function() if not bypassffa then if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; if not vRP.isInComa() and not vRP.isHandcuffed() then INserver.useHotbarItem({i}) end end end) RegisterKeyMapping('slot' .. i, 'Uses the item in slot ' .. i, 'keyboard', i) end function vRPin.openInventory(type) vRPin.loadPlayerInventory() isInInventory = true SendNUIMessage({ action = "display", type = type }) SetNuiFocus(true, true) TriggerScreenblurFadeIn(1) end function closeInventory(type) if not isInInventory then return end Wait(100) isInInventory = false SendNUIMessage({ action = "hide" }) SetNuiFocus(false, false) INserver.closeInventory({type}) TriggerScreenblurFadeOut(1) end RegisterNetEvent('fp-inventory:closeInventory',closeInventory) -- function vRPin.notify(item, text) -- -- SendNUIMessage({ -- -- action = "notify", -- -- item = item, -- -- text = text -- -- }) -- end RegisterNetEvent("fp-inventory:notify") AddEventHandler("fp-inventory:notify", function (item, text) vRPin.notify(item, text) end) RegisterNUICallback("NUIFocusOff", function(data, cb) closeInventory(data.type) cb("ok") end) RegisterNUICallback("UseItem", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestItemUse({data.item.name}) closeInventory(data.type) cb("ok") end) RegisterNUICallback('oferabani',function(data,cb) TriggerServerEvent('sxint$oferaBani') cb("ok") end) RegisterNUICallback("GiveItem", function(data, cb) if string.find(data.item.name, "WEAPON_") then eqWeap[data.item.name] = nil end -- for i = 1, 5 do if Hotbars[i] == data.item.name then Hotbars[i] = nil end end -- for i=1,5 do INserver.requestRemoveHotbar({i}) end if data.item.name == "smart_watch" then TriggerEvent("useSmartWatch", false) end if loadedWeapons[data.item.name] then currentWeapon = nil loadedWeapons[data.item.name] = nil RemoveAllPedWeapons(PlayerPedId(), true) INserver.removeWeapon({data.item.name}) end INserver.requestItemGive({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("GetBuzunar",function(data,cb) INserver.getBuzunarData({}, function(data) SendNUIMessage({ action = "buzunar", itemList = data, hotbarItems = nil, weight = 0, maxWeight = 0 }) end) end) RegisterNUICallback("PutIntoHotbar", function(data, cb) if string.find(data.item.name, "WEAPON_") then eqWeap[data.item.name] = true end INserver.requestPutHotbar({data.item.name, tonumber(data.number), tonumber(data.slot), data.from}) cb("ok") end) RegisterNUICallback("TakeFromHotbar", function(data, cb) if string.find(data.item.name, "WEAPON_") then eqWeap[data.item.name] = nil end if loadedWeapons[data.item.name] then currentWeapon = nil RemoveAllPedWeapons(PlayerPedId(), true) INserver.removeAttachments({data.item.name}) end INserver.requestRemoveHotbar({tonumber(data.item.slot)}) cb("ok") end) function vRPin.loadPlayerInventory() local playerId = PlayerId() local playerSource = GetPlayerServerId(playerId) INserver.getInventoryItems({playerSource}, function(items, hotbarItems, weight, maxWeight) SendNUIMessage({ action = "setItems", itemList = items, hotbarItems = hotbarItems, weight = weight, maxWeight = maxWeight }) end) end function vRPin.setSecondInventoryItems(items, weight, maxWeight, label) SendNUIMessage({ action = "setSecondInventoryItems", itemList = items, weight = weight, maxWeight = maxWeight, label = label }) end function Draw3DText(coords, text) SetDrawOrigin(coords) SetTextScale(0.35, 0.35) SetTextFont(4) SetTextEntry('STRING') SetTextCentre(1) AddTextComponentString(text) DrawText(0.0, 0.0) DrawRect(0.0, 0.0125, 0.03 + text:gsub('~.-~', ''):len() / 360, 0.03, 25, 25, 25, 140) ClearDrawOrigin() end Citizen.CreateThread(function() local ped = PlayerPedId() while true do Citizen.Wait(1) if not bypassffa then DisableControlAction(0, 37, true) -- TAB DisableControlAction(0, 45, true) -- R DisableControlAction(0, 140, true) -- Melee attack RemoveAllPickupsOfType(14) -- delete weapon drops if isInInventory then --DisableAllControlActions(0) end end end end) local savedClothing = {} local cfg = { ["hat"] = { Emote = { On = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 600}, Off = {Dict = "missheist_agency2ahelmet", Anim = "take_off_helmet_stand", Move = 51, Dur = 1200} }, type = "prop", id = 0 }, ["glasses"] = { Emote = { On = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400}, Off = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400} }, type = "prop", id = 1 }, ["watch"] = { Emote = { On = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, Off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} }, type = "prop", id = 6 }, ["bracelet"] = { Emote = { On = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200}, Off = {Dict = "nmt_3_rcm-10", Anim = "cs_nigel_dual-10", Move = 51, Dur = 1200} }, type = "prop", id = 7 }, ["glasses"] = { Emote = { On = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400}, Off = {Dict = "clothingspecs", Anim = "take_off", Move = 51, Dur = 1400} }, type = "prop", id = 1 }, ["mask"] = { Emote = {Dict = "mp_masks@standard_car@ds@", Anim = "put_on_mask", Move = 51, Dur = 800}, type = "drawable", id = 1, male = {-1, 0}, female = {-1, 0} }, ["vest"] = { Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200}, type = "drawable", id = 9, male = {0, 0}, female = {34, 0} }, ["shirt"] = { Emote = {Dict = "clothingtie", Anim = "try_tie_negative_a", Move = 51, Dur = 1200}, type = "multiple", male = { -- {drawableId, modelId} [11] = {15, 0}, [8] = {15, 0}, [3] = {15, 0}, [10] = {0, 0} }, female = { -- {drawableId, modelId} [11] = {187, 0}, [8] = {6, 0}, [3] = {4, 0}, [10] = {0, 0} } }, ["pants"] = { Emote = {Dict = "re@construction", Anim = "out_of_breath", Move = 51, Dur = 1300}, type = "drawable", id = 4, male = {14, 1}, female = {15, 0} }, ["shoes"] = { Emote = {Dict = "random@domestic", Anim = "pickup_low", Move = 0, Dur = 1200}, type = "drawable", id = 6, male = {99, 0}, female = {51, 0} } } local cooldown = 0 local function toggleClothing(clothType, skip) if not skip then if (cooldown or 0) > GetGameTimer() then return end end cooldown = GetGameTimer() + 100 local ped = PlayerPedId() local pedModel = GetEntityModel(ped) local isMale = true if pedModel == GetHashKey("mp_f_freemode_01") then isMale = false end if savedClothing[clothType] then if not skip then local anim = cfg[clothType].Emote if cfg[clothType].Emote.Off then anim = cfg[clothType].Emote.Off end RequestAnimDict(anim.Dict) while not HasAnimDictLoaded(anim.Dict) do Citizen.Wait(100) end TaskPlayAnim(ped, anim.Dict, anim.Anim, 3.0, 3.0, anim.Dur, IsPedInAnyVehicle(ped) and 51 or anim.Move, 0, false, false, false) Citizen.Wait(anim.Dur) end if cfg[clothType].type == "prop" then SetPedPropIndex(ped, cfg[clothType].id, savedClothing[clothType][1], savedClothing[clothType][2], true) elseif cfg[clothType].type == "drawable" then SetPedComponentVariation(ped, cfg[clothType].id, savedClothing[clothType][1], savedClothing[clothType][2]) else -- multiple for i in pairs(savedClothing[clothType]) do SetPedComponentVariation(ped, i, savedClothing[clothType][i][1], savedClothing[clothType][i][2]) end end savedClothing[clothType] = nil else if not skip then local anim = cfg[clothType].Emote if cfg[clothType].Emote.On then anim = cfg[clothType].Emote.On end RequestAnimDict(anim.Dict) while not HasAnimDictLoaded(anim.Dict) do Citizen.Wait(100) end TaskPlayAnim(ped, anim.Dict, anim.Anim, 3.0, 3.0, anim.Dur, IsPedInAnyVehicle(ped) and 51 or anim.Move, 0, false, false, false) Citizen.Wait(anim.Dur) end if cfg[clothType].type == "prop" then local propId = GetPedPropIndex(ped, cfg[clothType].id) local textureId = GetPedPropTextureIndex(ped, cfg[clothType].id) savedClothing[clothType] = {propId, textureId} ClearPedProp(ped, cfg[clothType].id) elseif cfg[clothType].type == "drawable" then local propId = GetPedDrawableVariation(ped, cfg[clothType].id) local textureId = GetPedTextureVariation(ped, cfg[clothType].id) savedClothing[clothType] = {propId, textureId} if isMale then SetPedComponentVariation(ped, cfg[clothType].id, cfg[clothType].male[1], cfg[clothType].male[2]) else SetPedComponentVariation(ped, cfg[clothType].id, cfg[clothType].female[1], cfg[clothType].female[2]) end else -- multiple if isMale then savedClothing[clothType] = {} for i in pairs(cfg[clothType].male) do local drawableId = cfg[clothType].male[i][1] local propId = GetPedDrawableVariation(ped, i) local textureId = GetPedTextureVariation(ped, i) savedClothing[clothType][i] = {propId, textureId} SetPedComponentVariation(ped, i, drawableId, cfg[clothType].male[i][2]) end else savedClothing[clothType] = {} for i in pairs(cfg[clothType].female) do local propId = GetPedDrawableVariation(ped, i) local textureId = GetPedTextureVariation(ped, i) savedClothing[clothType][i] = {propId, textureId} SetPedComponentVariation(ped, i, cfg[clothType].female[i][1], cfg[clothType].female[i][2]) end end end end end for _, type in next, {'hat', 'glasses', 'shirt', 'pants', 'shoes', 'watch', 'bracelet', 'mask', 'vest'} do RegisterCommand(type, function() toggleClothing(type) end); end local function resetClothing() for clothType in pairs(cfg) do if savedClothing[clothType] then toggleClothing(clothType, true) end end end exports("resetClothing", resetClothing) AddEventHandler("onResourceStop", function(res) if res == GetCurrentResourceName() then resetClothing() end end) -- Additional NUI Callbacks for new functionality RegisterNUICallback("UseHotbarItem", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.useHotbarItem({data.slot}) cb("ok") end) RegisterNUICallback("PutIntoHotbar", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestPutHotbar({data.item.name, tonumber(data.number), tonumber(data.slot), data.from}) cb("ok") end) RegisterNUICallback("TakeFromHotbar", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestRemoveHotbar({data.slot}) cb("ok") end) RegisterNUICallback("PutIntoDrop", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestPutDrop({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("TakeFromDrop", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestTakeDrop({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("PutIntoChest", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestPutChest({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("TakeFromChest", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestTakeChest({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("BuyItem", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestBuyItem({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("GiveItem", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestItemGive({data.item.name, tonumber(data.number)}) cb("ok") end) RegisterNUICallback("DropItem", function(data, cb) if (useDee or 0) > GetGameTimer() then return end useDee = GetGameTimer() + 3500; INserver.requestItemDrop({data.item.name, tonumber(data.number)}) cb("ok") end)