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

Solved Error load channel [TFS 1.2]

Joined
Jul 18, 2014
Messages
193
Solutions
2
Reaction score
15
Hi!, i was trying to create a new channel, but in console appears:
Code:
[Warning - Chat::load] Can not load script: meganfrey.lua

I really dont understand why this happens. This is my script in meganfrey.lua
Code:
function onJoin(player)
    if player:getStorageValue(456002) ~= 1 then
        player:sendCancelMessage("You may not enter here.")
        return true
    end
    if player:getStorageValue(MF.Storage.Start) == -1 then
        player:mfMessage("Hey! It's me, Megan. I'll guide you on this quest. If you want to ask me something, use command !meganfrey and your question. For example, !meganfrey mission. I'll call you when be necessary, do you understand?")
    elseif player:getStorageValue(MF.Storage.Start) == 1 and player:getStorageValue(MF.Storage.Step) == 1 then
        player:mfMessage("Welcome back! if you have any question, just say !meganfrey.")
    end
    return true
end

function onSpeak(player, type, message)  
    if player:getStorageValue(MF.Storage.Start) == -1 and message == "yes" then
        player:setStorageValue(MF.Storage.Start) == 1
        player:setStorageValue(MF.Storage.Step) == 1
        player:mfMessage("Great!.")
        return true
    elseif message == "!meganfrey" then
        player:mfMessage("Test 1")
        return true
    end
    return true
end

This is the line code in chatchannels.xml
Code:
<channel id="9" name="Megan Frey" script="meganfrey.lua" />

And this is the lib script that im using for new functions in chat channel Megan Frey:
Code:
MF = {
    Storage = {
        Start = 456010,
        Step = 456011
    }
}

function Player.mfMessage(self, txt, talkType)
   local playerId = self:getId()
   talkType = (talkType == nil) and TALKTYPE_CHANNEL_O or talkType

   local function eventMessage(playerId, text, talkType)
     local player = Player(playerId)
     if not player then
       return false
     end
     player:sendChannelMessage('Megan Frey:', txt, talkType, 9)
   end
   addEvent(eventMessage, 150, playerId, text, talkType)
   return true
end

Please help me.
PD: Of course i put "dofile(...)" in libs.lua
Also, if someone can explain me how works the parameter "message" in function onSpeak, would be great :)
Thanks.
 
Sorry, i found the error :/
It was here:
Code:
 player:setStorageValue(MF.Storage.Start) == 1
player:setStorageValue(MF.Storage.Step) == 1
Should be
Code:
player:setStorageValue(MF.Storage.Start, 1)
player:setStorageValue(MF.Storage.Step, 1)

Anyway, thanks and sorry.
By the way, someone knows how can i make the channel as private?
 
Back
Top