[Release] esx_durability

That would be awesome! :star_struck:

can someone try this script to get the durability values on client side im trying to get this the values on html

make a trigger on server for that

Can U Help Me Make One
I made One On Client Side But IT resets when he comes back in the city thats why i want it from The database

can add durability for each item?

X Item

  1. Create a column named ‘‘maxdurability’’ in table ‘‘items’’
ALTER TABLE `items` ADD COLUMN `maxdurability` INT(11)  NOT NULL DEFAULT '5';
  1. In server.lua change this
		elseif durability == 0 then

			MySQL.Async.execute("UPDATE user_inventory SET durability = @durability WHERE identifier = @identifier AND item = @item",
			{
				['@identifier']		= identifier,
				['@item']			= itemName,
				['@durability']		= Config.MaxDurability
			})
			if Config.Debug then
				print("default durability setted for item : " .. itemName .. " of player :"  .. identifier)
				print("the new durability is " .. Config.MaxDurability)
			end
		end

for this

		elseif durability == 0 then

			local MaxDurability = MySQL.Sync.fetchScalar("SELECT maxdurability FROM items WHERE name = @name", {['@name'] = itemName})

			MySQL.Async.execute("UPDATE user_inventory SET durability = @durability WHERE identifier = @identifier AND item = @item",
			{
				['@identifier']		= identifier,
				['@item']			= itemName,
				['@durability']		= MaxDurability
			})
			if Config.Debug then
				print("default durability setted for item : " .. itemName .. " of player :"  .. identifier)
				print("the new durability is " .. MaxDurability)
			end
		end
  1. Now go to the ‘items’ table and change the value of ‘maxdurability’ of the item you want. :slight_smile:

Note: You have to put one less number in the DB table to fit well. Ex: If you set 4 to ‘maxdurability’, the object will be broken to 5th use.

1 Like

Have u find it?

any update ?