• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua [SQLite] [ACTION] -=[TFS]=- 0.4 8.60 Casino Script

samuel157

/root
Joined
Mar 19, 2010
Messages
447
Solutions
3
Reaction score
49
Location
São Paulo, Brazil
GitHub
Samuel10M
Instead of winning these 12 items, the casino item appears at bp 6556 nothing to do with the set of items I was going to win

Lua:
-- Cassino System by LucasHere
function onUse(cid, item, frompos, item2, topos)
  pos1 = {x=264, y=344, z=7, stackpos=1} --posição que vai cria os items
  pos2 = {x=265, y=344, z=7, stackpos=1}
  pos3 = {x=266, y=344, z=7, stackpos=1}
 local config = {
    moneyneed = 100 * 20, -- money needed to play (scarab 100)
  }
 
  local premios = {
    [2189] = 1,
    [6529] = 1,
    [2546] = 1,
    [2352] = 1,
    [2545] = 1,
    [8851] = 1,
    [7424] = 1,
    [7735] = 1,
    [8293] = 1,
    [7450] = 1,
    [8931] = 1,
    [8856] = 1
  }
 
  function additem(cid, premios)
    for itemId, quantity in pairs(premios) do
      doPlayerAddItem(cid, itemId, quantity)
    end
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Player apostou no cassino e ganhou um conjunto de itens.")
  end
 
  if item.itemid == 1945 and getPlayerItemCount(cid, 11192) < config.moneyneed then
    doPlayerSendCancel(cid, "Desculpe, você não tem dinheiro suficiente para jogar!")
    return true
  end
 
  if item.itemid == 1945 then
    local randomOutcome = math.random(1, 8)
    doTransformItem(item.uid, 1946)
    doPlayerRemoveItem(cid, 11192, config.moneyneed)
   
    local premioItems = {}
   
    if randomOutcome == 1 then
      premioItems = { [6556] = 1, [6556] = 1, [6556] = 1 } -- Replace these IDs and quantities with your desired combination
    elseif randomOutcome == 2 or randomOutcome == 3 then
      premioItems = { [6557] = 1, [6557] = 1, [6557] = 1 }
    elseif randomOutcome >= 4 and randomOutcome <= 8 then
      premioItems = { [6556] = 1, [6556] = 1, [6556] = 1 }
    end
   
    addEvent(doCreateItem, 0, 0, pos1)
    addEvent(doCreateItem, 1000, 0, pos2)
    addEvent(doCreateItem, 2000, 0, pos3)
    addEvent(additem, 2000, cid, premioItems)
    return true
  end
 
  local item0 = getThingfromPos(pos1)
  local item1 = getThingfromPos(pos2)
  local item2 = getThingfromPos(pos3)
 
  if item.itemid == 1946 then
    doTransformItem(item.uid, 1945)
    if item0.itemid ~= 0 then
      doRemoveItem(item0.uid, 1)
    end
    if item1.itemid ~= 0 then
      doRemoveItem(item1.uid, 1)
    end
    if item2.itemid ~= 0 then
      doRemoveItem(item2.uid, 1)
    end
  else
    doTransformItem(item.uid, 1945)
  end
 
  return true
end

Screenshot_2.png
 
Last edited:
Lua:
-- Cassino System by LucasHere
function onUse(cid, item, frompos, item2, topos)
  pos1 = {x=264, y=344, z=7, stackpos=1} --posição que vai cria os items
  pos2 = {x=265, y=344, z=7, stackpos=1}
  pos3 = {x=266, y=344, z=7, stackpos=1}
 local config = {
    moneyneed = 100 * 20, -- money needed to play (scarab 100)
  }
 
  local premios = {
    [2189] = 1,
    [6529] = 1,
    [2546] = 1,
    [2352] = 1,
    [2545] = 1,
    [8851] = 1,
    [7424] = 1,
    [7735] = 1,
    [8293] = 1,
    [7450] = 1,
    [8931] = 1,
    [8856] = 1
  }
 
  function additem(cid, premios)
    for itemId, quantity in pairs(premios) do
      doPlayerAddItem(cid, itemId, quantity)
    end
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Player apostou no cassino e ganhou um conjunto de itens.")
  end
 
  if item.itemid == 1945 and getPlayerItemCount(cid, 11192) < config.moneyneed then
    doPlayerSendCancel(cid, "Desculpe, você não tem dinheiro suficiente para jogar!")
    return true
  end
 
  if item.itemid == 1945 then
    doTransformItem(item.uid, 1946)
    doPlayerRemoveItem(cid, 11192, config.moneyneed)

    addEvent(doCreateItem, 0, 0, pos1)
    addEvent(doCreateItem, 1000, 0, pos2)
    addEvent(doCreateItem, 2000, 0, pos3)
    addEvent(additem, 2000, cid, premios)
    return true
  end
 
  local item0 = getThingfromPos(pos1)
  local item1 = getThingfromPos(pos2)
  local item2 = getThingfromPos(pos3)
 
  if item.itemid == 1946 then
    doTransformItem(item.uid, 1945)
    if item0.itemid ~= 0 then
      doRemoveItem(item0.uid, 1)
    end
    if item1.itemid ~= 0 then
      doRemoveItem(item1.uid, 1)
    end
    if item2.itemid ~= 0 then
      doRemoveItem(item2.uid, 1)
    end
  else
    doTransformItem(item.uid, 1945)
  end
 
  return true
end
 
Lua:
-- Cassino System by LucasHere
function onUse(cid, item, frompos, item2, topos)
  local pos1 = {x = 256, y = 344, z = 7} -- position to create items
  local pos2 = {x = 257, y = 344, z = 7}
  local pos3 = {x = 258, y = 344, z = 7}
 
  local config = {
    moneyneed = 100 * 20, -- money needed to play (scarab 100)
  }
 
  local premios = {
    [2189] = 1,
    [6529] = 1,
    [2546] = 1,
    [2352] = 1,
    [2545] = 1,
    [8851] = 1,
    [7424] = 1,
    [7735] = 1,
    [8293] = 1,
    [7450] = 1,
    [8931] = 1,
    [8856] = 1
  }
 
  function additem(cid, premios)
    for itemId, quantity in pairs(premios) do
      doPlayerAddItem(cid, itemId, quantity)
    end
    doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Player apostou no cassino e ganhou um conjunto de itens.")
  end
 
  if item.itemid == 1945 and getPlayerItemCount(cid, 11192) < config.moneyneed then
    doPlayerSendCancel(cid, "Desculpe, você não tem dinheiro suficiente para jogar!")
    return true
  end
 
  if item.itemid == 1945 then
    local randomOutcome = math.random(1, 8)
    doTransformItem(item.uid, 1946)
    doPlayerRemoveItem(cid, 11192, config.moneyneed)
    
    local premioItems = {}
    
    if randomOutcome == 1 then
      premioItems = { [2189] = 1, [6529] = 1, [2546] = 1 }
    elseif randomOutcome == 2 or randomOutcome == 3 then
      premioItems = { [2352] = 1, [2545] = 1, [8851] = 1 }
    elseif randomOutcome >= 4 and randomOutcome <= 8 then
      premioItems = { [7424] = 1, [7735] = 1, [8293] = 1 }
    end
    
    addEvent(doCreateItem, 0, premioItems, pos1)
    addEvent(doCreateItem, 1000, premioItems, pos2)
    addEvent(doCreateItem, 2000, premioItems, pos3)
    addEvent(additem, 2000, cid, premioItems)
    return true
  end
 
  local item0 = getThingfromPos(pos1)
  local item1 = getThingfromPos(pos2)
  local item2 = getThingfromPos(pos3)
 
  if item.itemid == 1946 then
    doTransformItem(item.uid, 1945)
    if item0.itemid ~= 0 then
      doRemoveItem(item0.uid, 1)
    end
    if item1.itemid ~= 0 then
      doRemoveItem(item1.uid, 1)
    end
    if item2.itemid ~= 0 then
      doRemoveItem(item2.uid, 1)
    end
  else
    doTransformItem(item.uid, 1945)
  end
 
  return true
end
 

Similar threads

Back
Top