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

Channel message

psychosisneamia

~Beginner~
Joined
Jun 7, 2012
Messages
162
Reaction score
7
I need help fixing a script. I will explain it,

The script is to be when you open a channel it will have a Motd in the channel.

Code:
creaturescript.xml
Code:
<event type="channeljoin" name="Globalmotd" event="script" value="channel.lua"/>

Code:
 channel.lua

Code:
function onChannelJoin(cid, channel, users)
    if channel == 3 then
        doPlayerSendToChannel(0, cid, TALKTYPE_CHANNEL_W, 'Welcome '.. getCreatureName(cid) ..'!', 3)
    end
    return true
end

Code:
login.lia

Code:
registerCreatureEvent(cid, "channel")

Any help would be appreciated!
 
I don't know which server your using but for TFS 1.+
If you want text to appear when they join the channel you would use onJoin(player)
Code:
local CHANNEL_NUMBER = 1 -- change this to the channel number
local msg = "Hello there welcome to my channel :)"

local function Motd(player)
    player:sendChannelMessage(cid, msg, TALKTYPE_CHANNEL_O, CHANNEL_NUMBER)
end

function onJoin(player)
    addEvent(Motd, 1, player)
    return true
end

function onSpeak(player, type, message)
    return true
end
Code:
-- change channel id, name and script.lua
<channel id="1" name="New Channel" public="1" script="script.lua" />
 
BKvPdLA.png

Needs to match.
 
Back
Top