• TibiaFace

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

    .
    demo menumenu

    Afiliados



    Votar:

    [Problema] Ayuda en este script porfavor

    Compartir:

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

    1Chú ý [Problema] Ayuda en este script porfavor Vie Ago 30, 2019 2:48 pm

    paulina24

    paulina24
    Miembro
    Miembro
    Hola gente ! hace poco publique un pedido de recompensa para TFS 1.3, encontre uno, me funciono bien, pero tengo un problema que me da el item que deseo cada vez que subo nivel, yo necesito que me de el item una sola vez y no a cada rato

    aqui el script

    Código:
    local rewards = {
       [SKILL_LEVEL] = {
          {lvl = 11000, items = {{7451, 1}}, storage = 60000},
       },
    }

    function onAdvance(player, skill, oldlevel, newlevel)
       local rewardstr = "Items received: "
       local reward_t = {}
       if rewards[skill] then
          for j = 1, #rewards[skill] do
             local r = rewards[skill][j]
             if not r then
                return true
             end

             if newlevel >= r.lvl then
                if player:getStorageValue(r.storage) < 2 then
                   player:setStorageValue(r.storage, 1)
                   for i = 1, #r.items do
                      local itt = ItemType(r.items[i][1])
                      if itt then
                         player:addItem(r.items[i][1], r.items[i][2])
                         table.insert(reward_t, itt:getName() .. (r.items[i][2] > 1 and " x" .. r.items[i][2] or ""))
                      end
                   end
                end
             end
          end
       
          if #reward_t > 0 then
             player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, rewardstr .. table.concat(reward_t, ", "))
          end
       end
       return true
    end

    function onLogin(player)
       player:registerEvent("onadvance_reward")
       return true
    end


    Porfavor necesito de su magia

    2 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    prueba este

    Código:


    function onAdvance(cid, skill, oldlevel, newlevel)

                if getPlayerLevel(cid) >= 8 and getPlayerStorageValue(cid, 99963) ~= 1 then
                          doPlayerSetBalance(cid, getPlayerBalance(cid) + 2000)
                          setPlayerStorageValue(cid, 99963, 1)
                          doPlayerSendTextMessage(cid, 19, "You have received 2000 gold in your bank for advancing to Level 8.")

              elseif getPlayerLevel(cid) >= 40 and getPlayerStorageValue(cid, 99964) ~= 1 then
                          doPlayerSetBalance(cid, getPlayerBalance(cid) + 10000)
                          setPlayerStorageValue(cid, 99964, 1)
                          doPlayerSendTextMessage(cid, 19, "You have received 10000 gold in your bank for advancing to Level 40.")

            elseif getPlayerLevel(cid) >= 50 and getPlayerStorageValue(cid, 99965) ~= 1 then
                          doPlayerSetBalance(cid, getPlayerBalance(cid) + 30000)
                          setPlayerStorageValue(cid, 99965, 1)
                          doPlayerSendTextMessage(cid, 19, "You have received 30000 gold in your bank for advancing to Level 50.")

              elseif getPlayerLevel(cid) >= 75 and getPlayerStorageValue(cid, 99966) ~= 1 then
                          doPlayerSetBalance(cid, getPlayerBalance(cid) + 60000)
                          setPlayerStorageValue(cid, 99966, 1)
                          doPlayerSendTextMessage(cid, 19, "You have received 60000 gold in your bank for advancing to Level 75.")
                
                         
             elseif getPlayerLevel(cid) >= 100 and getPlayerStorageValue(cid, 99969) ~= 1 then
                          doPlayerSetBalance(cid, getPlayerBalance(cid) + 100000)
                          setPlayerStorageValue(cid, 99969, 1)
                        doPlayerSendTextMessage(cid, 19, "You have received 10000 gold in your bank for advancing to Level 100.")
                         
                         
             
                elseif getPlayerLevel(cid) >= 150 and getPlayerStorageValue(cid, 99970) ~= 1 then
                          doPlayerAddItem(cid, 5942)
                          setPlayerStorageValue(cid, 99970, 1)
                          doPlayerSendTextMessage(cid, 19, "You have received one blessed wooden stake because you reached level 150.")

                   

     elseif getPlayerLevel(cid) >= 200 and getPlayerStorageValue(cid, 99971) ~= 1 then
                          doPlayerAddItem(cid, 2195)
                          setPlayerStorageValue(cid, 99971, 1)
                          doPlayerSendTextMessage(cid, 19, "You have been awarded with 1 boots of haste for reaching level 200.")

                                        
                          end
              return TRUE
    end

    Código:
    <event type="advance" name="Recompense" script="recompense.lua"/>

    todo en creture scripts



    [Problema] Ayuda en este script porfavor YNU5B25
    2 participantes
    http://www.tibiaface.com

    paulina24

    paulina24
    Miembro
    Miembro
    me funciona perfecto pero como le pongo el item que quiero? es que me da dinero

    2 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    cambia esto
    Código:

     doPlayerSetBalance(cid, getPlayerBalance(cid) + 30000)

    por esto

    Código:
    player:addItem(xxxx, ccccc)

    xxxx ----> objeto
    ccccc ---> cantidad



    [Problema] Ayuda en este script porfavor YNU5B25
    2 participantes
    http://www.tibiaface.com

    paulina24

    paulina24
    Miembro
    Miembro
    GRAACIAS!! 100% funcionando.. tambien queria saber como puedo hacer que solo recian las recompensas por vocaciones.. ejemplo

    Código:
    if getPlayerLevel(cid) >= 12100 and getPlayerStorageValue(cid, 10000) ~= 1 then
                        doPlayerAddItem(cid, 7451)
                          setPlayerStorageValue(cid, 10000, 1)
                          doPlayerSendTextMessage(cid, 19, "Item received: Burning wand")

    quiero que solo lo recivan los sorcerer y druid

    2 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador


    if getPlayerLevel(cid) >= 12100 and getPlayerStorageValue(cid, 10000) ~= 1 and (isInArray({1, 2}, getPlayerVocation(cid))) then

    1 y 2 sorcere y druid



    [Problema] Ayuda en este script porfavor YNU5B25
    2 participantes
    http://www.tibiaface.com

    paulina24

    paulina24
    Miembro
    Miembro
    Excelente muchas gracias Maya! atento como siempre Very Happy

    2 participantes

    [Admin] God Maya

    [Admin] God Maya
    Administrador
    Administrador
    resuelto



    [Problema] Ayuda en este script porfavor YNU5B25
    2 participantes
    http://www.tibiaface.com

    Contenido patrocinado


    2 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).