• 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 why that happen? Disappointed

Maxwel1

Legend Of Everything
Joined
Feb 3, 2009
Messages
196
Reaction score
1
Location
In The Jungle
when i type /openserver or /close server something wrong happens and it don close even so why that happens?!



the error: [15/02/2009 21:57:47] Lua Script Error: [Npc interface]
[15/02/2009 21:57:47] data/npc/scripts/addons.lua:onCreatureSay


the talkaction script:



PHP:
function onSay(cid, words, param)
	local state = GAMESTATE_CLOSED
	if(words:sub(2, 2) == "o") 

then
		state = GAMESTATE_OPEN
	end

	local str = "Failed to " .. (state == 

GAMESTATE_CLOSED and "close" or "open") .. " server."
	if(doSetGameState(state) ~= LUA_ERROR) then
	

	str = "Server has been " .. (state == GAMESTATE_CLOSED and "closed" or "opened") .. " 

successfully."
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
	return TRUE
end


any idea?!



also why that error appears when someone talks to the addon seller?

[15/02/2009 21:57:47] data/npc/lib/npcsystem/npchandler.lua:576: table index is nil
[15/02/2009 21:57:47] stack traceback:
[15/02/2009 21:57:47] data/npc/lib/npcsystem/npchandler.lua:576: in function 'say'
[15/02/2009 21:57:47] data/npc/scripts/addons.lua:29: in function 'callback'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/npchandler.lua:371: in function 'onCreatureSay'
[15/02/2009 21:57:47] data/npc/scripts/addons.lua:7: in function <data/npc/scripts/addons.lua:7>



the script is modified that the addon seller sells the first addon for 10k and the second addon for frozen starlight but also here another problem that when it was on the tfs 0.2 and someone buy from him an addon he don say got the new addon set or even a negative that u don have enough money or the frozen starlight :(




the addon seller script:


PHP:
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

-- Storage IDs --
local addon1    = 35000
local addon2    = 35001

-- Messages
local newaddon    = 'Here you are, enjoy your brand new addon set!'
local noitems        = 'You do not have the required item or money.'
local already        = 'You already have this addon set!'

keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I offer first addons set and second addons set."})

function addon1func(cid, message, keywords, parameters, node)
  if(not npcHandler:isFocused(cid)) then
    return false
  end
  
  if isPremium(cid) == TRUE then
    if getPlayerStorageValue(cid,addon1) ~= 1 then
      if doPlayerRemoveMoney(cid,10000) == TRUE then
        npcHandler:say(newaddon)
        doSendMagicEffect(getCreaturePosition(cid), 13)
        doPlayerAddAddons(cid, 1)
        setPlayerStorageValue(cid,addon1,1)
      else
        npcHandler:say(noitems)
      end
    else
      npcHandler:say(already)
    end
  end
end

function addon2func(cid, message, keywords, parameters, node)
  if(not npcHandler:isFocused(cid)) then
    return false
  end

  if isPremium(cid) == TRUE then
    if getPlayerStorageValue(cid,addon2) ~= 1 then
      if doPlayerRemoveItem(cid,2361,1) == TRUE then
        npcHandler:say(newaddon)
        doSendMagicEffect(getCreaturePosition(cid), 13)
        doPlayerAddAddons(cid, 2)
        setPlayerStorageValue(cid,addon2,1)
      else
        npcHandler:say(noitems)
      end
    else
     npcHandler:say(already)
    end
  end
end

-- DEMONHUNTER END --

local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you need To buy the First addon for 10000 gold?'})
   node1:addChildKeyword({'yes'}, addon1func, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the money or the frozen starlight.', reset = true})

local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you need the Second  addon for a Frozen starlight as a gift?'})
    node2:addChildKeyword({'yes'}, addon2func, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the money or the frozen starlight.', reset = true})

npcHandler:addModule(FocusModule:new())



so we got 3 error the open and close talkaction and the lib error and that he don answer ppl and give the addon when it was on the tfs 9.2 maybe those lib error cuz the lib was of the tfs 0.2 not sure




thanks for helpuing guyz i luv that community soo helpufl special thanks to Gelio and Rudolf Czarodziej they helped me alot till i figured alot of previous error :D :D



Yours:

Lion
 
when i type /openserver or /close server something wrong happens and it don close even so why that happens?!



the error: [15/02/2009 21:57:47] Lua Script Error: [Npc interface]
[15/02/2009 21:57:47] data/npc/scripts/addons.lua:onCreatureSay


the talkaction script:



PHP:
function onSay(cid, words, param)
	local state = GAMESTATE_CLOSED
	if(words:sub(2, 2) == "o") 

then
		state = GAMESTATE_OPEN
	end

	local str = "Failed to " .. (state == 

GAMESTATE_CLOSED and "close" or "open") .. " server."
	if(doSetGameState(state) ~= LUA_ERROR) then
	

	str = "Server has been " .. (state == GAMESTATE_CLOSED and "closed" or "opened") .. " 

successfully."
	end

	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
	return TRUE
end


any idea?!



also why that error appears when someone talks to the addon seller?

[15/02/2009 21:57:47] data/npc/lib/npcsystem/npchandler.lua:576: table index is nil
[15/02/2009 21:57:47] stack traceback:
[15/02/2009 21:57:47] data/npc/lib/npcsystem/npchandler.lua:576: in function 'say'
[15/02/2009 21:57:47] data/npc/scripts/addons.lua:29: in function 'callback'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[15/02/2009 21:57:47] data/npc/lib/npcsystem/npchandler.lua:371: in function 'onCreatureSay'
[15/02/2009 21:57:47] data/npc/scripts/addons.lua:7: in function <data/npc/scripts/addons.lua:7>



the script is modified that the addon seller sells the first addon for 10k and the second addon for frozen starlight but also here another problem that when it was on the tfs 0.2 and someone buy from him an addon he don say got the new addon set or even a negative that u don have enough money or the frozen starlight :(




the addon seller script:


PHP:
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

-- Storage IDs --
local addon1    = 35000
local addon2    = 35001

-- Messages
local newaddon    = 'Here you are, enjoy your brand new addon set!'
local noitems        = 'You do not have the required item or money.'
local already        = 'You already have this addon set!'

keywordHandler:addKeyword({'addons'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I offer first addons set and second addons set."})

function addon1func(cid, message, keywords, parameters, node)
  if(not npcHandler:isFocused(cid)) then
    return false
  end
  
  if isPremium(cid) == TRUE then
    if getPlayerStorageValue(cid,addon1) ~= 1 then
      if doPlayerRemoveMoney(cid,10000) == TRUE then
        npcHandler:say(newaddon)
        doSendMagicEffect(getCreaturePosition(cid), 13)
        doPlayerAddAddons(cid, 1)
        setPlayerStorageValue(cid,addon1,1)
      else
        npcHandler:say(noitems)
      end
    else
      npcHandler:say(already)
    end
  end
end

function addon2func(cid, message, keywords, parameters, node)
  if(not npcHandler:isFocused(cid)) then
    return false
  end

  if isPremium(cid) == TRUE then
    if getPlayerStorageValue(cid,addon2) ~= 1 then
      if doPlayerRemoveItem(cid,2361,1) == TRUE then
        npcHandler:say(newaddon)
        doSendMagicEffect(getCreaturePosition(cid), 13)
        doPlayerAddAddons(cid, 2)
        setPlayerStorageValue(cid,addon2,1)
      else
        npcHandler:say(noitems)
      end
    else
     npcHandler:say(already)
    end
  end
end

-- DEMONHUNTER END --

local node1 = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you need To buy the First addon for 10000 gold?'})
   node1:addChildKeyword({'yes'}, addon1func, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the money or the frozen starlight.', reset = true})

local node2 = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you need the Second  addon for a Frozen starlight as a gift?'})
    node2:addChildKeyword({'yes'}, addon2func, {npcHandler = npcHandler, onlyFocus = true, reset = true})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then. Come back when you got the money or the frozen starlight.', reset = true})

npcHandler:addModule(FocusModule:new())



so we got 3 error the open and close talkaction and the lib error and that he don answer ppl and give the addon when it was on the tfs 9.2 maybe those lib error cuz the lib was of the tfs 0.2 not sure




thanks for helpuing guyz i luv that community soo helpufl special thanks to Gelio and Rudolf Czarodziej they helped me alot till i figured alot of previous error :D :D



Yours:

Lion

/closeserver bug is already reported.

About the NPC, Ill take a look at it later.
 
Back
Top