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

tfs 0.3.6 error script

rogersenchou

New Member
Joined
Nov 27, 2016
Messages
36
Reaction score
3
i have this error in this script and idk why D:
Code:
[22/12/2016 12:56:25] [Error - LuaScriptInterface::loadFile] data/npc/scripts/invocacion.lua:5: unexpected symbol near 'Â'
[22/12/2016 12:56:25] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/invocacion.lua
[22/12/2016 12:56:25] data/npc/scripts/invocacion.lua:5: unexpected symbol near 'Â'

and this is the script
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)   npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid)   npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg)   npcHandler:onCreatureSay(cid, type, msg) end
function onThink()   npcHandler:onThink() end

local config = {
   strge = 8001, -- Global Storage Key asignado a este script.
   hours = 5, -- Horas a transcurrir para poder invocar a otro.
   monst = "malvado", -- "Monstruo" que aparecerá.
   spawn = {x = 217, y = 136, z = 7}, -- Lugar donde aparecerá el "monstruo" anterior.
}

function greetCallback(cid)
   npcHandler:setMessage(MESSAGE_GREET, "Hola " .. getPlayerName(cid) .. ". Puedo {invocar} a " .. config.monst .. ", o deciros el {tiempo} que falta para poder volver a hacerlo.")
   return true
end

function creatureSayCallback(cid, type, msg)
   if(not npcHandler:isFocused(cid)) then
      return false
   end

   if msgcontains(msg, 'invocar') then
      if (os.time(t) > getGlobalStorageValue(config.strge)) then
         selfSay("Así sea, pues.", cid)
         local monster = doCreateMonster(config.monst, config.spawn)
         doSendMagicEffect(getThingPos(monster), CONST_ME_TELEPORT)
         doBroadcastMessage("¡Han invocado a " .. config.monst .. "!", MESSAGE_STATUS_WARNING)
         setGlobalStorageValue(config.strge, (os.time(t) + config.hours * 60 * 60))
      else
         selfSay("Debéis esperar " .. timeString(getGlobalStorageValue(config.strge) - os.time(t)) .. ", para que pueda volver a {invocar} a " .. config.monst .. ".", cid)
      end

   elseif msgcontains(msg, 'tiempo') then
      if (os.time(t) > getGlobalStorageValue(config.strge)) then
         selfSay("Ya puedo {invocar} a " .. config.monst .. "...", cid)
      else
         selfSay("Falta " .. timeString(getGlobalStorageValue(config.strge) - os.time(t)) .. ".", cid)
      end
   end

   return true
end

function timeString(timeDiff)
   local dateFormat = {
      {"dia", timeDiff / 60 / 60 / 24},
      {"hora", timeDiff / 60 / 60 % 24},
      {"minuto", timeDiff / 60 % 60},
      {"segundo", timeDiff % 60}
   }

   local out = {}
   for k, t in ipairs(dateFormat) do
      local v = math.floor(t[2])
      if(v > 0) then
         table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' y ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
      end
   end

   local ret = table.concat(out)
   if ret:len() < 16 and ret:find("segundo") then
      local a, b = ret:find(" y ")
      ret = ret:sub(b+1)
   end

   return ret
end

npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 

Similar threads

Back
Top