• 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!

Castle 24 tfs 1.5 Problem

jareczekjsp

Member
Joined
Jan 30, 2023
Messages
188
Reaction score
9
GitHub
Jarek123
Hello Guys I have Problem With Lever Script
when Players Click on lever from Castle is error
Lua:
Lua Script Error: [Action Interface]
data/actions/scripts/castlewarlever.lua:onUse
data/actions/scripts/castlewarlever.lua:54: attempt to concatenate global 'guildname' (a boolean value)
stack traceback:
        [C]: in function '__concat'
        data/actions/scripts/castlewarlever.lua:54: in function <data/actions/scripts/castlewarlever.lua:6>

Mys script is

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("or(a) "..getCreatureName(cid).." just conquered the castle "..castle_one_name.." for the guild \""..guildname.."\" By "..sto_vezes_total.." instead(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).." gained a "..getItemNameById(premio).." as a reward for their "..premio_vezes.." Achievements!", 21)
                          doPlayerAddItem(cid, premio,premio_cont)
                          doPlayerSendTextMessage(cid, 18, "You have received the "..getItemNameById(premio).." as a reward for their "..premio_vezes.." Achievements!")
                        -----------------------------------------------  -- 
                            if premio_reset == 1 then                    --
                               setPlayerStorageValue(cid,storages[1],0)  --  Resetar a contagem
                            end                                          --
                        -----------------------------------------------  --
                        
                       else
                       doPlayerSendTextMessage(cid, 18, "You don't have the ability to win the item. Let's check again in 10 seconds!")
                       addEvent(additem,10000,cid,premio,premio_cont,premio_reset)
                       end
                    end                                       
                 end               
            else
              doPlayerSendCancel(cid,"This castle has already been conquered by your guild!")
              doSendMagicEffect(position, 2)
            end
      else
      doPlayerSendCancel(cid,"The system is disabled")
      end     
   else
   doPlayerSendCancel(cid,"It is nescessario to have guild to dominate the castle!")
   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, "You have received the "..getItemNameById(premio).." as a reward for their "..premio_vezes.." conquistas!")
     if premio_reset == 1 then
        setPlayerStorageValue(cid,storages[1],0)
     end
    stopEvent(additem)
  else
  doPlayerSendTextMessage(cid, 18, "You don't have the ability to win the item. Checking again in 10 seconds!")
  addEvent(additem,10000,cid)
  end
end

-------------------------  por pc98
function isPlayerGuild(cid)
if getPlayerGuildName(cid) ~= "" then
return TRUE
else
return FALSE
end
end
 

Similar threads

Back
Top