• 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 castle 24h

ADM24horas

New Member
Joined
Oct 4, 2015
Messages
70
Reaction score
0
I want to add cooldown in the castle of the lever 30 minutes I have a code not know if it will help

if (getGlobalStorageValue(cid, 11680) >= os.time()) then
doPlayerSendCancel(cid,"Alavanca ja foi usada a pouco tempo, espere ela carregar!")
doSendMagicEffect(getCreaturePosition(cid), 2)
end
return true
end



version 8.60 otx



Code:
-----------------------------------           
---------SCRIPT por PC98------------    NAO REMOVA OS CREDITOS     
-----------------------------------           


function onUse(cid, item, frompos, item2, topos)

------------------ Inicio das Config ------------

local castle_one_name = "Castle24h"                  -- Nome do castelo 1
local storages = {154154,54321,123123}               -- Storages ( se vc eh iniciante, deixe como está...)



-------PREMIOs  I N D I V I D U A L ---------

local premio_por_vezes = 1         -- Premio por vezes de conquista de castelo. (1) = Ativo  (0) = Desativa.
local premio_vezes = 130            -- Caso ativo, a quantidade de conquista que o player tem, para ganhar PREMIO.
local premio = 5468                -- ID do Premio
local premio_cont = 1              -- Quantidade do Premio
local premio_reset = 1             -- Resetar o contador do premio depois que atingir a meta?? (1) = SIM  (0) = NAO
-------FIM PREMIOs I N D I V I D U A L ---------



----------------- FIM DAS CONFIG -----------------

local sto_ativ = getGlobalStorageValue(storages[2])
position = getCreaturePosition(cid)


   if isPlayerGuild(cid) == TRUE then
      if sto_ativ == 1 or sto_ativ == -1 then

         guildname = getPlayerGuildName(cid)    
         guild = getPlayerGuildId(cid)              
         guild_sto = getGlobalStorageValue(storages[3])
                 
            if guild ~= guild_sto then           
               setPlayerStorageValue(cid,guild_sto,guild)                     
               if getPlayerStorageValue(cid,storages[1]) == -1 then
                  setPlayerStorageValue(cid,storages[1],0)
               end
              
               sto_vezes = getPlayerStorageValue(cid,storages[1])                  
              
               setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
               setPlayerStorageValue(cid,storages[1], sto_vezes + 1)
              
               sto_vezes_total = getPlayerStorageValue(cid,storages[1])
                       
               doBroadcastMessage("O(a) "..getCreatureName(cid).." acabou de conquistar o castelo "..castle_one_name.." para a guild \""..guildname.."\" pela "..sto_vezes_total.."ª vez(s).", 22)
               doSendMagicEffect(position, 39) 
                
                 if premio_por_vezes == 1 then
                    if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
                       if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
                          doBroadcastMessage("O "..getCreatureName(cid).." ganhou uma(o) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!", 21)
                          doPlayerAddItem(cid, premio,premio_cont)
                          doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
                        -----------------------------------------------  -- 
                            if premio_reset == 1 then                    --
                               setPlayerStorageValue(cid,storages[1],0)  --  Resetar a contagem
                            end                                          --
                        -----------------------------------------------  --
                       
                       else
                       doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
                       addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
                       end
                    end                                       
                 end              
            else
              doPlayerSendCancel(cid,"Este castelo ja foi conquistado pela sua guild!")
              doSendMagicEffect(position, 2)
            end
      else
      doPlayerSendCancel(cid,"O sistema está desativado")
      end     
   else
   doPlayerSendCancel(cid,"É nescessario ter guild para dominar o castelo!")
   doSendMagicEffect(position, 2)
   end
end

------------------------- por pc98

function additem(cid,premio,premio_cont,premio_reset)

if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
    doPlayerAddItem(cid, premio,premio_cont)
    doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
     if premio_reset == 1 then
        setPlayerStorageValue(cid,storages[1],0)
     end
    stopEvent(additem)
  else
  doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Verificando novamente em 10 segundos!")
  addEvent(additem,10000,cid)
  end
end

-------------------------  por pc98
function isPlayerGuild(cid)
if getPlayerGuildName(cid) ~= "" then
return TRUE
else
return FALSE
end
end
 
No, I don't understand, your explanation made zero sense.
He says that either the script came from his server or that it was already in a dead forum. Acting like a douche doesn't help him at all.
 
He says that either the script came from his server or that it was already in a dead forum. Acting like a douche doesn't help him at all.
yes yes yes thanks you thanks you
yes yes yes thanks you thanks you
yes yes yes thanks you thanks you
 
Code:
local WAIT_TIME = 11680 --another global storage
-----------------------------------          
---------SCRIPT por PC98------------    NAO REMOVA OS CREDITOS :ok:
-----------------------------------          

------------------ Inicio das Config ------------
local castle_one_name = "Castle24h"                  -- Nome do castelo 1
local storages = {154154, 54321, 123123}               -- Storages ( se vc eh iniciante, deixe como está...)

-------PREMIOs  I N D I V I D U A L ---------
local premio_por_vezes = 1         -- Premio por vezes de conquista de castelo. (1) = Ativo  (0) = Desativa.
local premio_vezes = 130            -- Caso ativo, a quantidade de conquista que o player tem, para ganhar PREMIO.
local premio = 5468                -- ID do Premio
local premio_cont = 1              -- Quantidade do Premio
local premio_reset = 1             -- Resetar o contador do premio depois que atingir a meta?? (1) = SIM  (0) = NAO
-------FIM PREMIOs I N D I V I D U A L ---------
----------------- FIM DAS CONFIG -----------------

function onUse(cid, item, frompos, item2, topos)

    if getGlobalStorageValue(WAIT_TIME) >= os.time() then
        doPlayerSendCancel(cid, "Alavanca ja foi usada a pouco tempo, espere ela carregar!")
        doSendMagicEffect(getCreaturePosition(cid), 2)        
        return true
    end

    local sto_ativ = getGlobalStorageValue(storages[2])
    position = getCreaturePosition(cid)

    if isPlayerGuild(cid) == TRUE then
        if sto_ativ == 1 or sto_ativ == -1 then
            guildname = getPlayerGuildName(cid)    
            guild = getPlayerGuildId(cid)              
            guild_sto = getGlobalStorageValue(storages[3])
                 
            if guild ~= guild_sto then          
                setPlayerStorageValue(cid,guild_sto,guild)                    
                if getPlayerStorageValue(cid,storages[1]) == -1 then
                    setPlayerStorageValue(cid,storages[1],0)
                end

                setGlobalStorageValue(WAIT_TIME, os.time+(30*60))
             
                sto_vezes = getPlayerStorageValue(cid,storages[1])                                
                setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
                setPlayerStorageValue(cid,storages[1], sto_vezes + 1)              
                sto_vezes_total = getPlayerStorageValue(cid,storages[1])
                doBroadcastMessage("O(a) "..getCreatureName(cid).." acabou de conquistar o castelo "..castle_one_name.." para a guild \""..guildname.."\" pela "..sto_vezes_total.."ª vez(s).", 22)
                doSendMagicEffect(position, 39) 
               
                if premio_por_vezes == 1 then
                    if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
                        if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
                            doBroadcastMessage("O "..getCreatureName(cid).." ganhou uma(o) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!", 21)
                            doPlayerAddItem(cid, premio,premio_cont)
                            doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
                            -----------------------------------------------  -- 
                            if premio_reset == 1 then                    --
                                setPlayerStorageValue(cid,storages[1],0)  --  Resetar a contagem
                            end                                          --
                            -----------------------------------------------  --
                        else
                            doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
                            addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
                        end
                    end                                      
                end              
            else
                doPlayerSendCancel(cid,"Este castelo ja foi conquistado pela sua guild!")
                doSendMagicEffect(position, 2)
            end
        else
            doPlayerSendCancel(cid,"O sistema está desativado")
        end    
    else
        doPlayerSendCancel(cid,"É nescessario ter guild para dominar o castelo!")
        doSendMagicEffect(position, 2)
    end
end

------------------------- por pc98
function additem(cid,premio,premio_cont,premio_reset)
    if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
        doPlayerAddItem(cid, premio,premio_cont)
        doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
        if premio_reset == 1 then
            setPlayerStorageValue(cid,storages[1],0)
        end
        stopEvent(additem)
    else
        doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Verificando novamente em 10 segundos!")
        addEvent(additem,10000,cid)
    end
end

-------------------------  por pc98
function isPlayerGuild(cid)
    return getPlayerGuildName(cid) == ""
end
 
i was about to make the code sad u did it ;)
it doesnt change anything but i would return false.

PHP:
function onUse(cid, item, frompos, item2, topos)

if getGlobalStorageValue(WAIT_TIME) >= os.time() then
doPlayerSendCancel(cid, "Alavanca ja foi usada a pouco tempo, espere ela carregar!")
doSendMagicEffect(getCreaturePosition(cid), 2)
return false
end
 
Why do you bring scripts from another forum and then ask the people here to fix them, why not ask the people on the forum you took this from to fix or update the script?

I see nothing wrong on it? LOL, if he get here "MORE HELP" why not? Why should he ask it on the other forum? I see no reason... your post is just dumb ^^
 
He says that either the script came from his server or that it was already in a dead forum. Acting like a douche doesn't help him at all.
Neither does spoon feeding him the solution 100% of the time.
The reason this community is in its present state of progress for 0 new ideas is there is no enfasis to educate ones self.
Just look at every other framework community, either learn the core languages and the framework or don't bother "developing".

This community has a handful across the spectrum of people who took the time to learn some aspect of development to "help" others, the rest are just leechers.. if you consider this healthy progression your insane.
 
Neither does spoon feeding him the solution 100% of the time.
The reason this community is in its present state of progress for 0 new ideas is there is no enfasis to educate ones self.
Just look at every other framework community, either learn the core languages and the framework or don't bother "developing".

This community has a handful across the spectrum of people who took the time to learn some aspect of development to "help" others, the rest are just leechers.. if you consider this healthy progression your insane.
but from what I know the otland is the result of otservlist without our servers to use premium otservlist ot land would not feed that's my opnion, I presciso much help anyway thanks to all who will try to help me grateful.

Code:
local WAIT_TIME = 11680 --another global storage
-----------------------------------         
---------SCRIPT por PC98------------    NAO REMOVA OS CREDITOS :ok:
-----------------------------------         

------------------ Inicio das Config ------------
local castle_one_name = "Castle24h"                  -- Nome do castelo 1
local storages = {154154, 54321, 123123}               -- Storages ( se vc eh iniciante, deixe como está...)

-------PREMIOs  I N D I V I D U A L ---------
local premio_por_vezes = 1         -- Premio por vezes de conquista de castelo. (1) = Ativo  (0) = Desativa.
local premio_vezes = 130            -- Caso ativo, a quantidade de conquista que o player tem, para ganhar PREMIO.
local premio = 5468                -- ID do Premio
local premio_cont = 1              -- Quantidade do Premio
local premio_reset = 1             -- Resetar o contador do premio depois que atingir a meta?? (1) = SIM  (0) = NAO
-------FIM PREMIOs I N D I V I D U A L ---------
----------------- FIM DAS CONFIG -----------------

function onUse(cid, item, frompos, item2, topos)

    if getGlobalStorageValue(WAIT_TIME) >= os.time() then
        doPlayerSendCancel(cid, "Alavanca ja foi usada a pouco tempo, espere ela carregar!")
        doSendMagicEffect(getCreaturePosition(cid), 2)       
        return true
    end

    local sto_ativ = getGlobalStorageValue(storages[2])
    position = getCreaturePosition(cid)

    if isPlayerGuild(cid) == TRUE then
        if sto_ativ == 1 or sto_ativ == -1 then
            guildname = getPlayerGuildName(cid)   
            guild = getPlayerGuildId(cid)             
            guild_sto = getGlobalStorageValue(storages[3])
                
            if guild ~= guild_sto then         
                setPlayerStorageValue(cid,guild_sto,guild)                   
                if getPlayerStorageValue(cid,storages[1]) == -1 then
                    setPlayerStorageValue(cid,storages[1],0)
                end

                setGlobalStorageValue(WAIT_TIME, os.time+(30*60))
            
                sto_vezes = getPlayerStorageValue(cid,storages[1])                               
                setGlobalStorageValue(storages[3],getPlayerGuildId(cid))
                setPlayerStorageValue(cid,storages[1], sto_vezes + 1)             
                sto_vezes_total = getPlayerStorageValue(cid,storages[1])
                doBroadcastMessage("O(a) "..getCreatureName(cid).." acabou de conquistar o castelo "..castle_one_name.." para a guild \""..guildname.."\" pela "..sto_vezes_total.."ª vez(s).", 22)
                doSendMagicEffect(position, 39)
              
                if premio_por_vezes == 1 then
                    if getPlayerStorageValue(cid,storages[1]) == premio_vezes then
                        if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
                            doBroadcastMessage("O "..getCreatureName(cid).." ganhou uma(o) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!", 21)
                            doPlayerAddItem(cid, premio,premio_cont)
                            doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
                            -----------------------------------------------  --
                            if premio_reset == 1 then                    --
                                setPlayerStorageValue(cid,storages[1],0)  --  Resetar a contagem
                            end                                          --
                            -----------------------------------------------  --
                        else
                            doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Vamos verificar novamente em 10 segundos!")
                            addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
                        end
                    end                                     
                end             
            else
                doPlayerSendCancel(cid,"Este castelo ja foi conquistado pela sua guild!")
                doSendMagicEffect(position, 2)
            end
        else
            doPlayerSendCancel(cid,"O sistema está desativado")
        end   
    else
        doPlayerSendCancel(cid,"É nescessario ter guild para dominar o castelo!")
        doSendMagicEffect(position, 2)
    end
end

------------------------- por pc98
function additem(cid,premio,premio_cont,premio_reset)
    if getItemWeightById(premio,1) <= getPlayerFreeCap(cid) then
        doPlayerAddItem(cid, premio,premio_cont)
        doPlayerSendTextMessage(cid, 18, "Voce recebeu o(a) "..getItemNameById(premio).." como recompensa das suas "..premio_vezes.." conquistas!")
        if premio_reset == 1 then
            setPlayerStorageValue(cid,storages[1],0)
        end
        stopEvent(additem)
    else
        doPlayerSendTextMessage(cid, 18, "Voce nao tem capacidade para ganhar o item. Verificando novamente em 10 segundos!")
        addEvent(additem,10000,cid)
    end
end

-------------------------  por pc98
function isPlayerGuild(cid)
    return getPlayerGuildName(cid) == ""
end

I can not rule the castle that can be?
nor with nor with GOD player

http://prntscr.com/9t75y9
 
Last edited by a moderator:

Similar threads

Back
Top