Code Monkey home page Code Monkey logo

devyn-backitems's Introduction

devyn-backitems

FiveM Lua Script for displaying items on the players back. NOTE: I do not provide any support for this. Just posted because a lot of people asked for it.

image

If you want to add/remove/change model/backplacement it can be done in the BackItems.lua.

Setup: in qb-spawn in client.lua edit the function PostSpawnPlayer and add TriggerEvent("backitems:start") to the last line. It should now look like this.

  local function PostSpawnPlayer(ped)
  FreezeEntityPosition(ped, false)
  RenderScriptCams(false, true, 500, true, true)
  SetCamActive(cam, false)
  DestroyCam(cam, true)
  SetCamActive(cam2, false)
  DestroyCam(cam2, true)
  SetEntityVisible(PlayerPedId(), true)
  Wait(500)
  DoScreenFadeIn(250)
  TriggerEvent("backitems:start")
  end

If you use cd_spawnselect you need to edit the function "HasFullySpanwedIn" in the client_customize_me.lua and add TriggerEvent("backitems:start")

image

If you use qb-clothing you need to add the follow event to the openMenu function.

TriggerEvent("backitems:displayItems", false)

It should now look like this.

   function openMenu(allowedMenus)
    TriggerEvent("backitems:displayItems", false)
    previousSkinData = json.encode(skinData)
    creatingCharacter = true

    local PlayerData = QBCore.Functions.GetPlayerData()
    local trackerMeta = PlayerData.metadata["tracker"]

    GetMaxValues()
    SendNUIMessage({
        action = "open",
        menus = allowedMenus,
        currentClothing = skinData,
        hasTracker = trackerMeta,
    })
    SetNuiFocus(true, true)
    SetCursorLocation(0.9, 0.25)

    FreezeEntityPosition(PlayerPedId(), true)

    enableCam()
end

Also add TriggerEvent("backitems:displayItems", true) to the close NUI callback

RegisterNUICallback('close', function()
    SetNuiFocus(false, false)
    creatingCharacter = false
    disableCam()
    TriggerEvent("backitems:displayItems", true)
    FreezeEntityPosition(PlayerPedId(), false)
end)

If you use fivem-appearance you need to add the triggers whenever you call the startPlayerCustomization export

	TriggerEvent("backitems:displayItems", false)
	exports['fivem-appearance']:startPlayerCustomization(function (appearance)
		if appearance then
			TriggerServerEvent('fivem-appearance:save', appearance)
			print('Player Clothing Saved')
		else
			print('Canceled')
		end
		TriggerEvent("backitems:displayItems", true)
	end, config)

devyn-backitems's People

Contributors

darktrovx avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.