• 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 Error - GlobalEvents::timer

quirknepx

New Member
Joined
Aug 28, 2010
Messages
17
Reaction score
3
Hello I have a globalevent error.
Here's the console error:
Code:
[Error - Globalevent Interface]
data/globalevent/scripts/ctf.lua:onTime
Description:
data/globalevent/scripts/ctf.lua:8: attempt to call global 'doCreatureExecuteTalkaction' <a nil value>
stack traceback:
data/globalevent/scripts/ctf.lua:8: in function <data/globalevent/scripts/ctf.lua:2>
[Error - GlobalEvents::timer] Couldn't execute event: Auto CTF

And the globalevent script(ctf.lua) is:

Code:
function onTime()
	local value = 0
	for a,b in ipairs(getOnlinePlayers()) do
	value = value + 1
end
	if value >= 1 then
	doCreatureExecuteTalkaction(getPlayerByName(getPlayersOnline()[1]), "/ctf open", true)
	return true
end
	return true
end

The globalevent.xml tag is:
Code:
<globalevent name="Auto CTF" time="12:26" script="ctf.lua"/>

Thank's for the attention:)
 
Lua:
function onTime()
	local value = 0
	for a, pid in ipairs(getOnlinePlayers()) do
local	value = 1
	if value >= 1 then
	doCreatureExecuteTalkaction(getPlayerByName(pid), "/ctf open", true)
	return true
end
end
	return true
end
 
Last edited:
Thank's for answering but unfortunelly now I get this console error:
Code:
[Error - Globalevent Interface]
data/globalevent/scripts/ctf.lua:onTime
Description:
data/globalevent/scripts/ctf.lua:6: attempt to call global 'doCreatureExecuteTalkaction' <a nil value>
stack traceback:
data/globalevent/scripts/ctf.lua:6: in function <data/globalevent/scripts/ctf.lua:1>
[Error - GlobalEvents::timer] Couldn't execute event: Auto CTF

Almost the same error:c
 
It means that the function "doCreatureExecuteTalkaction" doesnt exist...

Update: I suggest to trasnfer the script "/ctf open" to globalevent, because you what you did will make all players online execute the command "/ctf open"
 
the script "/ctf open", doesn't exist, the script "/ctf" does, the parameters for "/ctf" are, "open" and "close"
Here's the ctf.lua (talkaction):
Code:
--[[
    Capture The Flag System 
    Author: Maxwell Denisson(MaXwEllDeN)
    Version: 1.0
]]

function onSay(cid, words, param)
   local CTF = _CTF_LIB

   if not(CTF.nopen) then
      return false
   end      

   if (param == "open") then
      if (getGlobalStorageValue(CTF.CTFSto) > 0) then
         return doPlayerSendTextMessage(cid, 27, "O CTF já está aberto!")
      end

      doBroadcastMessage("[CTF] Capture The Flag foi aberto!")
      setGlobalStorageValue(CTF.CTFSto, 1)
      doPlayerSendTextMessage(cid, 27, "CTF foi aberto com sucesso!")
   elseif (param == "close") then
      if (getGlobalStorageValue(CTF.CTFSto) < 1) then
         return doPlayerSendTextMessage(cid, 27, "O CTF já está fechado!")
      end

      doBroadcastMessage("[CTF] Capture The Flag foi fechado!")
      
      for a, _ in pairs(CTF.flags) do
         setGlobalStorageValue(a, 0)
         setGlobalStorageValue(a-15, 0)         
      end      
      
      for _, cid in pairs (getOnlinePlayers()) do       
          local cid = getPlayerByNameWildcard(b)
          if (getPlayerStorageValue(cid, CTF.teamssto) > 0) then
             doPlayerSendTextMessage(cid, 22, "[CTF] Capture The Flag foi fechado e você saiu do evento!")

             if (getPlayerStorageValue(cid, CTF.Flagsto) > 0) then
                local bant = getPlayerStorageValue(cid, CTF.Flagsto)
                devolverFlag(cid, bant)
             end              
             
             setPlayerStorageValue(cid, CTF.teamssto, -1)
             setPlayerStorageValue(cid, CTF.Flagsto, -1)
	          doPlayerSetTown(cid, CTF.TownExit)
             doTeleportThing(cid, getTownTemplePosition(CTF.TownExit))             
          end
      end            
      
      setGlobalStorageValue(CTF.CTFSto, -1)
      doPlayerSendTextMessage(cid, 27, "CTF foi fechado com sucesso!")
   end 
   return true
end
 
Back
Top Bottom