Greets,
Tested with TFS 1.1
Making your server feel more custom in big ways but also in smaller detailed ways is an important aspect from my side as a developer. These scripts will give you the option to make your own named chat channels, your custom text when they are opened instead of real tibias as well as forcing your players to have them open onLogin to use them.
chatchannels.xml
I recommend you to start from channel id="10" and up on custom channels as lower might force you with Real Tibia Text, unless you want it ofcourse. If you want real tibias text you could simply try channel ids 1-7 and just change the channel name, name="ServerName".
mainchannel.lua
Remember to change this if you create another channel:
"TALKTYPE_CHANNEL_O, 10" where 10 = channelID.
Now we'll force our players to open our chosen chat-channels everytime they login.
creaturescripts.xml
chatchannels.lua
Simply add Another line of "player: openChannel(WantedNumber)" if you want to have them open another chat channel.
Good luck and have a nice day.
Kind Regards,
Eldin.
Tested with TFS 1.1
Making your server feel more custom in big ways but also in smaller detailed ways is an important aspect from my side as a developer. These scripts will give you the option to make your own named chat channels, your custom text when they are opened instead of real tibias as well as forcing your players to have them open onLogin to use them.
chatchannels.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel id="10" name="ServerName" public="1" script="mainchannel.lua" />
</channels>
I recommend you to start from channel id="10" and up on custom channels as lower might force you with Real Tibia Text, unless you want it ofcourse. If you want real tibias text you could simply try channel ids 1-7 and just change the channel name, name="ServerName".
mainchannel.lua
Code:
local function sendMessage(cid)
local player = Player(cid)
if not player then
return false
end
player:sendChannelMessage("", "Welcome to the Main Channel.\nHere you can advertise all kinds of things. Among others, advertise ingame events, seek characters for a quest or a hunting group, find members for your guild or look for somebody to help you with something.", TALKTYPE_CHANNEL_O, 10)
end
function onJoin(player)
addEvent(sendMessage, 100, player:getId())
return true
end
function onSpeak(player, type, message)
local playerAccountType = player:getAccountType()
if player:getLevel() == 1 and playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
player:sendCancelMessage("You may not speak into channels as long as you are on level 1.")
return false
end
if type == TALKTYPE_CHANNEL_Y then
if playerAccountType >= ACCOUNT_TYPE_GAMEMASTER then
type = TALKTYPE_CHANNEL_O
end
elseif type == TALKTYPE_CHANNEL_O then
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER then
type = TALKTYPE_CHANNEL_Y
end
elseif type == TALKTYPE_CHANNEL_R1 then
if playerAccountType < ACCOUNT_TYPE_GAMEMASTER and not getPlayerFlagValue(player, PlayerFlag_CanTalkRedChannel) then
type = TALKTYPE_CHANNEL_Y
end
end
return type
end
Remember to change this if you create another channel:
"TALKTYPE_CHANNEL_O, 10" where 10 = channelID.
Now we'll force our players to open our chosen chat-channels everytime they login.
creaturescripts.xml
Code:
<event type="login" name="ChatChannels" script="chatchannels.lua"/>
chatchannels.lua
Code:
function onLogin(cid)
local player = Player(cid)
player:openChannel(10)
return true
end
Simply add Another line of "player: openChannel(WantedNumber)" if you want to have them open another chat channel.
Good luck and have a nice day.
Kind Regards,
Eldin.