[Release]Model-Menu V3 [9th Oct]

Really cool to see a menu that isn’t made with either NativeUI or WarMenu. Even though I like both of them :stuck_out_tongue:

RegisterServerEvent("clothes:save")
AddEventHandler("clothes:save",function(player_data)
	local _source = source
	local identifier = getID("steam",_source)
	MySQL.Async.execute("UPDATE users SET skin = @skin WHERE identifier = @identifier", {
	  ['@skin'] = tostring(json.encode(player_data)),
	  ['@identifier'] = identifier
	})
	models[identifier] = player_data
	
		local xPlayer = ESX.GetPlayerFromId(source)
		local playerLoadout = {}

		Citizen.CreateThread(function()
		Citizen.Wait(5000)
			for i=1, #playerLoadout, 1 do
				if playerLoadout[i].label ~= nil then
					xPlayer.addWeapon(playerLoadout[i].name, playerLoadout[i].ammo)
				end
			end
		end)
	
	-- Give weapons etc
end)`Preformatted text`

can anyone help with deleting weapons ? do i am close to make this work or thats not the way ?

	local _source = source
	local xPlayer   = ESX.GetPlayerFromId(source)
	local playerLoadout = xPlayer.getLoadout()
	xPlayer.addWeapon(playerLoadout)

SaltyGrandpa could you please help with this code
i realy want to use this script but have no idea how to make that i get weapons back i am trying many difrent ways looking for some code in other scripts but cant get this to work i dont know lua that good to make this
hope you understud and can help me and others here
thank you

There is an esx:restoreLoadout client-side function. Not that this is not safe for net by default, so you cannot trigger it from the server.

so i need this function on server side so playerdata i need change to xplayer ?

	local xPlayer = ESX.GetPlayerFromId(source)
	local weaponback = xPlayer.getLoadout()

	for i=1, weaponback, 1 do
    local weaponHash = GetHashKey(weaponback[i].name)
    GiveWeaponToPed(xPlayer, weaponHash, weaponback[i].ammo, false, false)
  end

No? Did you read my response? Lol. You just have to trigger that client event that I listed.

Ok
what i did now is
i add this function to client and add trigger from server to this function

and now when exit game and come back i got weapon back
only when change model i dont get it back

and i need to solve problem with getting female basic skin after log in
but i see its problem with skinchanger

anyway
Thank you SaltyGrandpa for help!

If you replace TriggerServerEvent("clothes:loaded") in client.lua with TriggerEvent('esx:restoreLoadout') this should work. This is on line 333 and 365.

This resource will not work with esx_skins or skinchanger or any other clothing/player model menu. They’ll constantly conflict with each other.

3 Likes

This isn’t really a good place for this discussion, but pulling from es_extended/client/main.lua:

-- Save loadout
Citizen.CreateThread(function()

  while true do

    Citizen.Wait(1)

    local playerPed      = GetPlayerPed(-1)
    local loadout        = {}
    local loadoutChanged = false

    if IsPedDeadOrDying(playerPed) then
      LoadoutLoaded = false
    end

    for i=1, #Config.Weapons, 1 do

      local weaponHash = GetHashKey(Config.Weapons[i].name)

      if HasPedGotWeapon(playerPed,  weaponHash,  false) and Config.Weapons[i].name ~= 'WEAPON_UNARMED' then

        local ammo = GetAmmoInPedWeapon(playerPed, weaponHash)

        if LastLoadout[Config.Weapons[i].name] == nil or LastLoadout[Config.Weapons[i].name] ~= ammo then
          loadoutChanged = true
        end

        LastLoadout[Config.Weapons[i].name] = ammo

        table.insert(loadout, {
          name  = Config.Weapons[i].name,
          ammo  = ammo,
          label = Config.Weapons[i].label
        })

      else

        if LastLoadout[Config.Weapons[i].name] ~= nil then
          loadoutChanged = true
        end

        LastLoadout[Config.Weapons[i].name] = nil

      end

    end

    if loadoutChanged and LoadoutLoaded then
      ESX.PlayerData.loadout = loadout
      TriggerServerEvent('esx:updateLoadout', loadout)
    end

  end
end)

Anything further should be discussed on the ESX Base release thread.

how to install and how to add models? ty in advance ^^

It’s in the config.lua.

sorry but i don’t get anything there ><

Hi am new to this what is it i should put in the sql and how do i do it, help - new scripter!

so when i download where do i put it to make it work in fivem servers? or is this just for making your own server? noob here help pls

Here’s the rest of the locations in case you don’t feel like doing the work yourself.

I also added the ability to change the color too (since it was already kinda there).

local clothing_shops = {
    {name="Clothing Store", color=44, id=73, x=1932.76989746094, y=3727.73510742188, z=32.8444557189941},
    {name="Clothing Store", color=44, id=73, x=1693.26, y=4822.27, z=42.06},
    {name="Clothing Store", color=44, id=73, x=125.83, y=-223.16, z=54.55},
    {name="Clothing Store", color=44, id=73, x=-710.16, y=-153.26, z=37.41},
    {name="Clothing Store", color=44, id=73, x=-821.69, y=-1073.90, z=11.32},
    {name="Clothing Store", color=44, id=73, x=-1192.81, y=-768.24, z=17.31},
    {name="Clothing Store", color=44, id=73, x=4.25, y=6512.88, z=31.87},
    {name="Clothing Store", color=44, id=73, x=425.471, y=-806.164, z=29.4911},
    {name="Clothing Store", color=44, id=73, x=-161.19, y=-303.28, z=39.73},
    {name="Clothing Store", color=44, id=73, x=1190.19, y=2713.57, z=38.22},
	{name="Clothing Store", color=44, id=73, x=617.52, y=2761.59, z=42.09},
	{name="Clothing Store", color=44, id=73, x=-1108.28, y=2708.7, z=19.11},
	{name="Clothing Store", color=44, id=73, x=-3173.24, y=1046.57, z=20.86},
	{name="Clothing Store", color=44, id=73, x=72.47, y=-1398.88, z=29.38},
	{name="Clothing Store", color=44, id=73, x=-1452.85, y=-237.52, z=49.81},
}

@Frazzle - I created a PR on GitHub if you’re interested.

I have a question, and the question is. Is it possible to get different types of beards?

Is it compatible with @Dunko ´s vRP?

LG

This is great but doesn’t work with Kashacters probably because this is a text file save not SQL.

There is only one type of beard. Is there a way I can add more to this?

Also it would be good if I could call a net function so that in my character creation system I could call for the menu to open so they can make a character or select a ped