• TibiaFace

    Tibiaface | Una comunidad Open Tibia donde encontras : mapas, scripts, Otserver, npc y amigos etc ...

    .
    demo menumenu

    Afiliados



    Votar:

    (AYUDA) AYUDA PARA MODIFICAR UN SCRIPT!! 8.60

    Compartir:

    Ver el tema anterior Ver el tema siguiente Ir abajo  Mensaje (Página 1 de 1.)

    Gm Lurran

    Gm Lurran
    Miembro
    Miembro
    Buenas noches tibiaface

    espero que esten muy bien y que puedan ayudarme
    dejare su like y su agradecimiento de antemano veran:


    tengo este script !
    Código:
    -- UniqueIDs usados abajo.
              local pos = { -- Cada coordenada correspondiente a su palanca.
           -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
          [5880]={{x=2158, y=2183, z=8, stackpos = 255}},
          [5881]={{x=1023, y=1003, z=6, stackpos = 255}},
          [5882]={{x=1025, y=1003, z=6, stackpos = 255}},
          
          [5883]={{x=1020, y=1011, z=6, stackpos = 255}},
          [5884]={{x=1022, y=1011, z=6, stackpos = 255}},
          [5885]={{x=1025, y=1011, z=6, stackpos = 255}},
          
          [5886]={{x=1017, y=1006, z=6, stackpos = 255}},
          [5887]={{x=1017, y=1008, z=6, stackpos = 255}},
          
          [5888]={{x=1028, y=1006, z=6, stackpos = 255}},
          [5889]={{x=1028, y=1008, z=6, stackpos = 255}},
          }
              local cash = 2160 -- ItemID del objeto apostado.
          
              local t = {
                 [{1, 55}] = 0,
                 [{56, 90}] = 2,
                 [{91, 100}] = 3
              }
              local a, b = getItemInfo(cash).name, getItemInfo(cash).plural
              function onUse(cid, item, fromPosition, itemEx, toPosition)
             local lel = pos[item.uid]
                 local v = getThingfromPos(lel[1])
         local p = getThingPosition(cid)
                 if v.itemid ~= cash then
                    return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
                 end
        
               local r = math.random(100)
                 for i, k in pairs(t) do
         if lel then
                    if r >= i[1] and r <= i[2] then
                       doRemoveItem(v.uid)
                       if k < 1 then
                          doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                          doSendMagicEffect(p, CONST_ME_MAGIC_RED)
          doSendMagicEffect(lel[1], CONST_ME_POFF)
                       else
                          doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                          doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
          doCreateItem(cash, v.type * k, lel[1])
                       end
                       return true
                    end
                 end
     end
           end


    la funcion ,    pues es un script de casino    cuando uno pone digamos  1 cc
    y jala la palanca   si ganas te lo DUPLICA    si pierdes te lo quita todo , actualmente puedes poner cualquier cantidad es decir de 1 cc hasta 1 kk y te lo duplica si ganas !!!


    LO QUE YO QUIERO PEDIRLES ES QUE ME AYUDEN A PONERLE REESTRICCION DE  DINERO   ,   ES DECIR QUE SOLO SE PUEDAN PONER 2 CC   Y SI ALGUN  JUGADOR QUIERE PONERLE MAS  NO FUNCIONE   O SI QUIERE PONERLE MENOS IGUAL   SOLO 2 CC PARA QUE ASI SEA UN POCO MAS COMPLICADO QUE SE HAGAN RICOS TAN FACIL ! !!!

    ESPERO SER CLARO Y TAMBIEN QUE TENGAN LA DISPOSICION Y EL TIEMPO DE AYUDARME  SE LOS AGRADECERIA BASTANTE Smile!!

    mi version de tibia 8.60
    consola : The OTX Server Version: (2.15)


    GRACIAS DE ANTEMANO SALUDOS A TODOS Smile

    4 participantes

    akane

    akane
    Miembro
    Miembro
    prueba con esto:

    Código:
    -- UniqueIDs usados abajo.
    local pos = {
        -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
        [5880] = {{x = 2158, y = 2183, z = 8, stackpos = 255}},
        [5881] = {{x = 1023, y = 1003, z = 6, stackpos = 255}},
        [5882] = {{x = 1025, y = 1003, z = 6, stackpos = 255}},
        [5883] = {{x = 1020, y = 1011, z = 6, stackpos = 255}},
        [5884] = {{x = 1022, y = 1011, z = 6, stackpos = 255}},
        [5885] = {{x = 1025, y = 1011, z = 6, stackpos = 255}},
        [5886] = {{x = 1017, y = 1006, z = 6, stackpos = 255}},
        [5887] = {{x = 1017, y = 1008, z = 6, stackpos = 255}},
        [5888] = {{x = 1028, y = 1006, z = 6, stackpos = 255}},
        [5889] = {{x = 1028, y = 1008, z = 6, stackpos = 255}},
    }
    local cash = 2160 -- ItemID del objeto apostado.

    local t = {
        [{1, 55}] = 0,
        [{56, 90}] = 2,
        [{91, 100}] = 3
    }
    local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local lel = pos[item.uid]
        local v = getThingfromPos(lel[1])
        local p = getThingPosition(cid)

        -- Verifica que el jugador tenga exactamente 2 Crystal Coins.
        local itemCount = getPlayerItemCount(cid, cash)
        if itemCount ~= 2 then
            return doCreatureSay(cid, 'Necesitas exactamente 2 ' .. b .. ' para usar la palanca.', TALKTYPE_ORANGE_1, false, cid)
        end

        if v.itemid ~= cash then
            return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
        end

        local r = math.random(100)
        for i, k in pairs(t) do
            if lel then
                if r >= i[1] and r <= i[2] then
                    doRemoveItem(v.uid)
                    if k < 1 then
                        doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                        doSendMagicEffect(p, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(lel[1], CONST_ME_POFF)
                    else
                        doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                        doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
                        doCreateItem(cash, v.type * k, lel[1])
                    end

                    -- Remueve las Crystal Coins usadas.
                    doPlayerRemoveItem(cid, cash, 2)

                    return true
                end
            end
        end
    end

    4 participantes

    Gm Lurran

    Gm Lurran
    Miembro
    Miembro
    akane escribió:prueba con esto:

    Código:
    -- UniqueIDs usados abajo.
    local pos = {
        -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
        [5880] = {{x = 2158, y = 2183, z = 8, stackpos = 255}},
        [5881] = {{x = 1023, y = 1003, z = 6, stackpos = 255}},
        [5882] = {{x = 1025, y = 1003, z = 6, stackpos = 255}},
        [5883] = {{x = 1020, y = 1011, z = 6, stackpos = 255}},
        [5884] = {{x = 1022, y = 1011, z = 6, stackpos = 255}},
        [5885] = {{x = 1025, y = 1011, z = 6, stackpos = 255}},
        [5886] = {{x = 1017, y = 1006, z = 6, stackpos = 255}},
        [5887] = {{x = 1017, y = 1008, z = 6, stackpos = 255}},
        [5888] = {{x = 1028, y = 1006, z = 6, stackpos = 255}},
        [5889] = {{x = 1028, y = 1008, z = 6, stackpos = 255}},
    }
    local cash = 2160 -- ItemID del objeto apostado.

    local t = {
        [{1, 55}] = 0,
        [{56, 90}] = 2,
        [{91, 100}] = 3
    }
    local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local lel = pos[item.uid]
        local v = getThingfromPos(lel[1])
        local p = getThingPosition(cid)

        -- Verifica que el jugador tenga exactamente 2 Crystal Coins.
        local itemCount = getPlayerItemCount(cid, cash)
        if itemCount ~= 2 then
            return doCreatureSay(cid, 'Necesitas exactamente 2 ' .. b .. ' para usar la palanca.', TALKTYPE_ORANGE_1, false, cid)
        end

        if v.itemid ~= cash then
            return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
        end

        local r = math.random(100)
        for i, k in pairs(t) do
            if lel then
                if r >= i[1] and r <= i[2] then
                    doRemoveItem(v.uid)
                    if k < 1 then
                        doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                        doSendMagicEffect(p, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(lel[1], CONST_ME_POFF)
                    else
                        doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                        doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
                        doCreateItem(cash, v.type * k, lel[1])
                    end

                    -- Remueve las Crystal Coins usadas.
                    doPlayerRemoveItem(cid, cash, 2)

                    return true
                end
            end
        end
    end




    gracias por responder e probado con el script bro   y no me a funcionado !

    la palanca al usarla si me dice que ocupo solamente 2 cc pero cuando pongo los 2 cc y tiro de la palanca me vuelve a decir lo mismo es decir no hace nada !

    no se si tenga algo que ver que sea unique id  y no action id !! ??

    :/

    adjunto foto!

    [Tienes que estar registrado y conectado para ver este vínculo]

    4 participantes

    GalaxyDev

    GalaxyDev
    Miembro
    Miembro
    Gm Lurran escribió:Buenas noches tibiaface

    espero que esten muy bien y que puedan ayudarme
    dejare su like y su agradecimiento de antemano veran:


    tengo este script !
    Código:
    -- UniqueIDs usados abajo.
              local pos = { -- Cada coordenada correspondiente a su palanca.
           -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
          [5880]={{x=2158, y=2183, z=8, stackpos = 255}},
          [5881]={{x=1023, y=1003, z=6, stackpos = 255}},
          [5882]={{x=1025, y=1003, z=6, stackpos = 255}},
          
          [5883]={{x=1020, y=1011, z=6, stackpos = 255}},
          [5884]={{x=1022, y=1011, z=6, stackpos = 255}},
          [5885]={{x=1025, y=1011, z=6, stackpos = 255}},
          
          [5886]={{x=1017, y=1006, z=6, stackpos = 255}},
          [5887]={{x=1017, y=1008, z=6, stackpos = 255}},
          
          [5888]={{x=1028, y=1006, z=6, stackpos = 255}},
          [5889]={{x=1028, y=1008, z=6, stackpos = 255}},
          }
              local cash = 2160 -- ItemID del objeto apostado.
          
              local t = {
                 [{1, 55}] = 0,
                 [{56, 90}] = 2,
                 [{91, 100}] = 3
              }
              local a, b = getItemInfo(cash).name, getItemInfo(cash).plural
              function onUse(cid, item, fromPosition, itemEx, toPosition)
             local lel = pos[item.uid]
                 local v = getThingfromPos(lel[1])
         local p = getThingPosition(cid)
                 if v.itemid ~= cash then
                    return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
                 end
        
               local r = math.random(100)
                 for i, k in pairs(t) do
         if lel then
                    if r >= i[1] and r <= i[2] then
                       doRemoveItem(v.uid)
                       if k < 1 then
                          doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                          doSendMagicEffect(p, CONST_ME_MAGIC_RED)
          doSendMagicEffect(lel[1], CONST_ME_POFF)
                       else
                          doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                          doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
          doCreateItem(cash, v.type * k, lel[1])
                       end
                       return true
                    end
                 end
     end
           end


    la funcion ,    pues es un script de casino    cuando uno pone digamos  1 cc
    y jala la palanca   si ganas te lo DUPLICA    si pierdes te lo quita todo , actualmente puedes poner cualquier cantidad es decir de 1 cc hasta 1 kk y te lo duplica si ganas !!!


    LO QUE YO QUIERO PEDIRLES ES QUE ME AYUDEN A PONERLE REESTRICCION DE  DINERO   ,   ES DECIR QUE SOLO SE PUEDAN PONER 2 CC   Y SI ALGUN  JUGADOR QUIERE PONERLE MAS  NO FUNCIONE   O SI QUIERE PONERLE MENOS IGUAL   SOLO 2 CC PARA QUE ASI SEA UN POCO MAS COMPLICADO QUE SE HAGAN RICOS TAN FACIL ! !!!

    ESPERO SER CLARO Y TAMBIEN QUE TENGAN LA DISPOSICION Y EL TIEMPO DE AYUDARME  SE LOS AGRADECERIA BASTANTE Smile!!

    mi version de tibia 8.60
    consola : The OTX Server Version: (2.15)


    GRACIAS DE ANTEMANO SALUDOS A TODOS Smile

    Podrias intentar probar esto, la verdad nose si funcionara pero basandome en el codigo fuente de otx 2.15 deberia hacerlo en caso que genere algun error en consola porfavor publica el error para ayudarte a arreglarlo. saludos

    Código:
    -- UniqueIDs usados abajo.
    local pos = {
      -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
      [5880]={{x=2158, y=2183, z=8, stackpos = 255}},
      [5881]={{x=1023, y=1003, z=6, stackpos = 255}},
      [5882]={{x=1025, y=1003, z=6, stackpos = 255}},
     
      [5883]={{x=1020, y=1011, z=6, stackpos = 255}},
      [5884]={{x=1022, y=1011, z=6, stackpos = 255}},
      [5885]={{x=1025, y=1011, z=6, stackpos = 255}},
     
      [5886]={{x=1017, y=1006, z=6, stackpos = 255}},
      [5887]={{x=1017, y=1008, z=6, stackpos = 255}},
     
      [5888]={{x=1028, y=1006, z=6, stackpos = 255}},
      [5889]={{x=1028, y=1008, z=6, stackpos = 255}},
    }

    local cash = 2160 -- ItemID del objeto apostado.

    local t = {
      [{1, 55}] = 0,
      [{56, 90}] = 2,
      [{91, 100}] = 3
    }

    local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

    function onUse(cid, item, fromPosition, itemEx, toPosition)
      local lel = pos[item.uid]
      local v = getThingfromPos(lel[1])
      local p = getThingPosition(cid)
      local betAmount = getItemAttribute(item.uid, "betAmount") or 0

      -- Verificar que la cantidad apostada esté dentro del rango permitido (hasta 2 CC)
      if betAmount <= 0 or betAmount > 200000 then
          return doCreatureSay(cid, 'La cantidad apostada debe estar entre 1 CC y 2 CC.', TALKTYPE_ORANGE_1, false, cid)
      end

      if v.itemid ~= cash then
          return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
      end

      local r = math.random(100)
      for i, k in pairs(t) do
          if lel then
            if r >= i[1] and r <= i[2] then
                doRemoveItem(v.uid)
                if k < 1 then
                  doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                  doSendMagicEffect(p, CONST_ME_MAGIC_RED)
                  doSendMagicEffect(lel[1], CONST_ME_POFF)
                else
                  doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                  doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
                  doCreateItem(cash, v.type * k, lel[1])
                end
                return true
            end
          end
      end
    end


    De todas formas dejare el github por si quieres revisar alguna optimizacion del codigo saludos.

    link github

    Smile



    [Tienes que estar registrado y conectado para ver este vínculo] Servidor 24/7 Full Animes  Smile    MI GITHUB (REVSCRIPTS TFS 1.3-1.5))
    4 participantes

    Gm Lurran

    Gm Lurran
    Miembro
    Miembro
    GalaxyDev escribió:
    Gm Lurran escribió:Buenas noches tibiaface

    espero que esten muy bien y que puedan ayudarme
    dejare su like y su agradecimiento de antemano veran:


    tengo este script !
    Código:
    -- UniqueIDs usados abajo.
              local pos = { -- Cada coordenada correspondiente a su palanca.
           -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
          [5880]={{x=2158, y=2183, z=8, stackpos = 255}},
          [5881]={{x=1023, y=1003, z=6, stackpos = 255}},
          [5882]={{x=1025, y=1003, z=6, stackpos = 255}},
          
          [5883]={{x=1020, y=1011, z=6, stackpos = 255}},
          [5884]={{x=1022, y=1011, z=6, stackpos = 255}},
          [5885]={{x=1025, y=1011, z=6, stackpos = 255}},
          
          [5886]={{x=1017, y=1006, z=6, stackpos = 255}},
          [5887]={{x=1017, y=1008, z=6, stackpos = 255}},
          
          [5888]={{x=1028, y=1006, z=6, stackpos = 255}},
          [5889]={{x=1028, y=1008, z=6, stackpos = 255}},
          }
              local cash = 2160 -- ItemID del objeto apostado.
          
              local t = {
                 [{1, 55}] = 0,
                 [{56, 90}] = 2,
                 [{91, 100}] = 3
              }
              local a, b = getItemInfo(cash).name, getItemInfo(cash).plural
              function onUse(cid, item, fromPosition, itemEx, toPosition)
             local lel = pos[item.uid]
                 local v = getThingfromPos(lel[1])
         local p = getThingPosition(cid)
                 if v.itemid ~= cash then
                    return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
                 end
        
               local r = math.random(100)
                 for i, k in pairs(t) do
         if lel then
                    if r >= i[1] and r <= i[2] then
                       doRemoveItem(v.uid)
                       if k < 1 then
                          doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                          doSendMagicEffect(p, CONST_ME_MAGIC_RED)
          doSendMagicEffect(lel[1], CONST_ME_POFF)
                       else
                          doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                          doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
          doCreateItem(cash, v.type * k, lel[1])
                       end
                       return true
                    end
                 end
     end
           end


    la funcion ,    pues es un script de casino    cuando uno pone digamos  1 cc
    y jala la palanca   si ganas te lo DUPLICA    si pierdes te lo quita todo , actualmente puedes poner cualquier cantidad es decir de 1 cc hasta 1 kk y te lo duplica si ganas !!!


    LO QUE YO QUIERO PEDIRLES ES QUE ME AYUDEN A PONERLE REESTRICCION DE  DINERO   ,   ES DECIR QUE SOLO SE PUEDAN PONER 2 CC   Y SI ALGUN  JUGADOR QUIERE PONERLE MAS  NO FUNCIONE   O SI QUIERE PONERLE MENOS IGUAL   SOLO 2 CC PARA QUE ASI SEA UN POCO MAS COMPLICADO QUE SE HAGAN RICOS TAN FACIL ! !!!

    ESPERO SER CLARO Y TAMBIEN QUE TENGAN LA DISPOSICION Y EL TIEMPO DE AYUDARME  SE LOS AGRADECERIA BASTANTE Smile!!

    mi version de tibia 8.60
    consola : The OTX Server Version: (2.15)


    GRACIAS DE ANTEMANO SALUDOS A TODOS Smile

    Podrias intentar probar esto, la verdad nose si funcionara pero basandome en el codigo fuente de otx 2.15 deberia hacerlo en caso que genere algun error en consola porfavor publica el error para ayudarte a arreglarlo. saludos

    Código:
    -- UniqueIDs usados abajo.
    local pos = {
      -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
      [5880]={{x=2158, y=2183, z=8, stackpos = 255}},
      [5881]={{x=1023, y=1003, z=6, stackpos = 255}},
      [5882]={{x=1025, y=1003, z=6, stackpos = 255}},
     
      [5883]={{x=1020, y=1011, z=6, stackpos = 255}},
      [5884]={{x=1022, y=1011, z=6, stackpos = 255}},
      [5885]={{x=1025, y=1011, z=6, stackpos = 255}},
     
      [5886]={{x=1017, y=1006, z=6, stackpos = 255}},
      [5887]={{x=1017, y=1008, z=6, stackpos = 255}},
     
      [5888]={{x=1028, y=1006, z=6, stackpos = 255}},
      [5889]={{x=1028, y=1008, z=6, stackpos = 255}},
    }

    local cash = 2160 -- ItemID del objeto apostado.

    local t = {
      [{1, 55}] = 0,
      [{56, 90}] = 2,
      [{91, 100}] = 3
    }

    local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

    function onUse(cid, item, fromPosition, itemEx, toPosition)
      local lel = pos[item.uid]
      local v = getThingfromPos(lel[1])
      local p = getThingPosition(cid)
      local betAmount = getItemAttribute(item.uid, "betAmount") or 0

      -- Verificar que la cantidad apostada esté dentro del rango permitido (hasta 2 CC)
      if betAmount <= 0 or betAmount > 200000 then
          return doCreatureSay(cid, 'La cantidad apostada debe estar entre 1 CC y 2 CC.', TALKTYPE_ORANGE_1, false, cid)
      end

      if v.itemid ~= cash then
          return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
      end

      local r = math.random(100)
      for i, k in pairs(t) do
          if lel then
            if r >= i[1] and r <= i[2] then
                doRemoveItem(v.uid)
                if k < 1 then
                  doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                  doSendMagicEffect(p, CONST_ME_MAGIC_RED)
                  doSendMagicEffect(lel[1], CONST_ME_POFF)
                else
                  doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                  doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
                  doCreateItem(cash, v.type * k, lel[1])
                end
                return true
            end
          end
      end
    end


    De todas formas dejare el github por si quieres revisar alguna optimizacion del codigo saludos.

    link github

    Smile



    no me funciono bro , no me arroja error pero no hace nada :/ ni quita ni da !

    adjunto fotos ; aun asi te dejo tu like : D !

    [Tienes que estar registrado y conectado para ver este vínculo]

    4 participantes

    SoyFabi

    SoyFabi
    Miembro
    Miembro
    Código:
    -- UniqueIDs usados abajo.
    local pos = {
        -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
        [5880] = {{x = 2158, y = 2183, z = 8, stackpos = 255}},
        [5881] = {{x = 1023, y = 1003, z = 6, stackpos = 255}},
        [5882] = {{x = 1025, y = 1003, z = 6, stackpos = 255}},
        [5883] = {{x = 1020, y = 1011, z = 6, stackpos = 255}},
        [5884] = {{x = 1022, y = 1011, z = 6, stackpos = 255}},
        [5885] = {{x = 1025, y = 1011, z = 6, stackpos = 255}},
        [5886] = {{x = 1017, y = 1006, z = 6, stackpos = 255}},
        [5887] = {{x = 1017, y = 1008, z = 6, stackpos = 255}},
        [5888] = {{x = 1028, y = 1006, z = 6, stackpos = 255}},
        [5889] = {{x = 1028, y = 1008, z = 6, stackpos = 255}},
    }

    local function getItemCountOnPosition(item, pos)
        local item_pos = {x = pos.x, y = pos.y, z = pos.z}
        local item_count = 0
        for i = 1, 255 do
            local check_pos = {x = item_pos.x, y = item_pos.y, z = item_pos.z, stackpos = i}
            if getThingFromPos(check_pos).itemid <= 0 then
                break
            elseif getThingFromPos(check_pos).itemid == item then
                if isItemStackable(getThingFromPos(check_pos).itemid) == true then
                    item_count = item_count + getThingFromPos(check_pos).type
                else
                    item_count = item_count + 1
                end
            end
        end 
        return item_count
    end

    local cash = 2160 -- ItemID del objeto apostado.

    local t = {
        [{1, 55}] = 0,
        [{56, 90}] = 2,
        [{91, 100}] = 3
    }
    local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local lel = pos[item.uid]
        local v = getThingfromPos(lel[1])
        local p = getThingPosition(cid)

       if v.itemid ~= cash then
          return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
        end

       if getItemCountOnPosition(cash, lel[1]) ~= 2 then
          return doCreatureSay(cid, 'Necesitas al menos 2 ' .. b .. ' en la posicion de apuestas para apostar.', TALKTYPE_ORANGE_1, false, cid)
       end
       
        local r = math.random(100)
        for i, k in pairs(t) do
            if lel then
                if r >= i[1] and r <= i[2] then
                    if k < 1 then
                        doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                        doSendMagicEffect(p, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(lel[1], CONST_ME_POFF)
                   doRemoveItem(getTileThingByPos(lel[1]).uid)
                    else
                        doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                        doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
                      -- doCreateItem(cash, v.type * k, lel[1]) -- Si quieres que se cree el item en el suelo.
                   doPlayerAddItem(cid, cash, v.type * k)
                    end
                    return true
                end
            end
        end
    end

    4 participantes

    Gm Lurran

    Gm Lurran
    Miembro
    Miembro
    SoyFabi escribió:
    Código:
    -- UniqueIDs usados abajo.
    local pos = {
        -- [UniqueID de Palanca] = {{Coordenada de apuestas}},
        [5880] = {{x = 2158, y = 2183, z = 8, stackpos = 255}},
        [5881] = {{x = 1023, y = 1003, z = 6, stackpos = 255}},
        [5882] = {{x = 1025, y = 1003, z = 6, stackpos = 255}},
        [5883] = {{x = 1020, y = 1011, z = 6, stackpos = 255}},
        [5884] = {{x = 1022, y = 1011, z = 6, stackpos = 255}},
        [5885] = {{x = 1025, y = 1011, z = 6, stackpos = 255}},
        [5886] = {{x = 1017, y = 1006, z = 6, stackpos = 255}},
        [5887] = {{x = 1017, y = 1008, z = 6, stackpos = 255}},
        [5888] = {{x = 1028, y = 1006, z = 6, stackpos = 255}},
        [5889] = {{x = 1028, y = 1008, z = 6, stackpos = 255}},
    }

    local function getItemCountOnPosition(item, pos)
        local item_pos = {x = pos.x, y = pos.y, z = pos.z}
        local item_count = 0
        for i = 1, 255 do
            local check_pos = {x = item_pos.x, y = item_pos.y, z = item_pos.z, stackpos = i}
            if getThingFromPos(check_pos).itemid <= 0 then
                break
            elseif getThingFromPos(check_pos).itemid == item then
                if isItemStackable(getThingFromPos(check_pos).itemid) == true then
                    item_count = item_count + getThingFromPos(check_pos).type
                else
                    item_count = item_count + 1
                end
            end
        end 
        return item_count
    end

    local cash = 2160 -- ItemID del objeto apostado.

    local t = {
        [{1, 55}] = 0,
        [{56, 90}] = 2,
        [{91, 100}] = 3
    }
    local a, b = getItemInfo(cash).name, getItemInfo(cash).plural

    function onUse(cid, item, fromPosition, itemEx, toPosition)
        local lel = pos[item.uid]
        local v = getThingfromPos(lel[1])
        local p = getThingPosition(cid)

       if v.itemid ~= cash then
          return doCreatureSay(cid, 'Solamente has de usar ' .. b .. '.', TALKTYPE_ORANGE_1, false, cid)
        end

       if getItemCountOnPosition(cash, lel[1]) ~= 2 then
          return doCreatureSay(cid, 'Necesitas al menos 2 ' .. b .. ' en la posicion de apuestas para apostar.', TALKTYPE_ORANGE_1, false, cid)
       end
       
        local r = math.random(100)
        for i, k in pairs(t) do
            if lel then
                if r >= i[1] and r <= i[2] then
                    if k < 1 then
                        doSendAnimatedText(p, 'PERDISTE', COLOR_RED)
                        doSendMagicEffect(p, CONST_ME_MAGIC_RED)
                        doSendMagicEffect(lel[1], CONST_ME_POFF)
                   doRemoveItem(getTileThingByPos(lel[1]).uid)
                    else
                        doSendAnimatedText(p, 'GANASTE', COLOR_GREEN)
                        doSendMagicEffect(p, CONST_ME_MAGIC_GREEN)
                      -- doCreateItem(cash, v.type * k, lel[1]) -- Si quieres que se cree el item en el suelo.
                   doPlayerAddItem(cid, cash, v.type * k)
                    end
                    return true
                end
            end
        end
    end




    wooow!! SoyFabi funciono ala perfeccion ! no puedes usar ni menos ni mas solo 2 cc exactamente lo que queria te dejo tu like y tu agradecimiento ! espero devolver el favor algun dia : D


    gracias a todos los que se tomaron el tiempo de ayudar doy por cerrado el tema



    TEMA RESUELTO!!

    4 participantes

    Contenido patrocinado


    4 participantes

    Ver el tema anterior Ver el tema siguiente Volver arriba  Mensaje (Página 1 de 1.)

    Permisos de este foro:
    No puedes responder a temas en este foro.

     

    BienvenidosTibiaFace es una comunidad de Open Tibia. Para participar debes estar registrado (click para Regístrate).