[help] Random items

In the link i sent u, you can find this code:

Items = {
  "cokep",
  "hpipe",
  "lighter",
  "nitro"
}

function RandomItem()
  return Items[math.random(#Items)]
end

function RandomNumber()
	return math.random(2,6)
end

RegisterServerEvent('bankrob:loot')
AddEventHandler('bankrob:loot', function()
  local xPlayer = ESX.GetPlayerFromId(source)
  math.randomseed(GetGameTimer())
  xPlayer.addInventoryItem(RandomItem(), RandomNumber())
end)

Put the items up below after you created them on your data base and trigger it on your client side

1 Like