• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Channel

Mooosie

mistofdeath.com
Premium User
Joined
Aug 2, 2008
Messages
737
Solutions
2
Reaction score
46
Location
Sweden
How can i do so:
When i join channel 11, it greets.
and then when i type "skills" inside the channel, it returns like:

The skills are: blablabla...
 
Code:
function onJoinChannel(cid, channel, users)
	if channel == 11 then
		doPlayerSendToChannel(0, cid, TALKTYPE_CHANNEL_W, 'Welcome '.. getCreatureName(cid) ..'!', 11)
	end
	return true
end

Code:
function onSay(cid, words, param, channel)
	if channel == 11 then
		doPlayerSendToChannel(0, cid, TALKTYPE_CHANNEL_W, 'The skills are: ...', 11)
	end
	return true
end
 
thx, the first worked, but..
The second. i want that.
If the player types "skills" inside the channel, the channel says, The skills are...
 
Not working with "mscontains"

Code:
[12/05/2011 19:53:27] [Error - CreatureScript Interface] 
[12/05/2011 19:53:27] data/creaturescripts/scripts/xxx.lua
[12/05/2011 19:53:27] Description: 
[12/05/2011 19:53:27] data/creaturescripts/scripts/talentcha.lua:12: attempt to call global 'msgcontains' (a nil value)
[12/05/2011 19:53:27] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/xxx.lua)
 
Last edited:
Goto global.lua

And add this function
Code:
function msgcontains(message, keyword)
	if(type(keyword) == "table") then
		return table.isStrIn(keyword, message)
	end
 
	local a, b = message:lower():find(keyword:lower())
	if(a ~= nil and b ~= nil) then
		return true
	end
 
	return false
end

It should work, this function is usually for npc's but should work for creature too
 
Script:
Code:
function sendMessage(cid, message)
    return doPlayerSendChannelMessage(cid, "", message, TALKTYPE_CHANNEL_O, 11)
end

function onJoinChannel(cid, channel, users)
        if channel == 11 then
            return addEvent(sendMessage, 100, cid, "[Talent Channel] Welcome, ".. getPlayerName(cid) ..", here you can upgrade your skills with talent points by saying, 'Skills'.")
        end
        return true
    end
   
 if(msgcontains(message, 'skills')) then
    doCreatureSay(cid, "lol")
    return true
end

function onLeaveChannel (cid, channel, users)
    if channel == 11 then
        return onLogout(cid)
    end
    return true
end

Error:
Code:
[12/05/2011 20:24:53] [Error - CreatureScript Interface]
[12/05/2011 20:24:53] data/creaturescripts/scripts/talentcha.lua
[12/05/2011 20:24:53] Description:
[12/05/2011 20:24:53] data/lib/050-function.lua:826: attempt to index local 'message' (a nil value)
[12/05/2011 20:24:53] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/talentcha.lua)
 
Last edited by a moderator:
The talkaction:
Code:
function onSay(cid, words, param, channel)
	if channel == 11 and words == "skills" then
		doPlayerSendToChannel(0, cid, TALKTYPE_CHANNEL_W, 'The skills are: ...', 11)
	end
	return true
end
 
You mean, like:
talkactions/scripts/skills.lua:
Code:
function onSay(cid, words, param, channel)
    if channel == 11 then
        doPlayerSendToChannel(0, cid, TALKTYPE_CHANNEL_W, 'The skills are: ...', 11)
    end
    return true
end
talkactions/talkactions.xml:
Code:
    <talkaction log="yes" words="skills" event="script" value="skills.lua"/>

I don't work and no errors in console... Even if it worked, none could write "Skills" without the channel...
 
Last edited by a moderator:
LUA:
function onSay(cid, words, param, channel)
	if channel == 11 then
		doPlayerSendChannelMessage(cid, 0, 'The skills are: ...', TALKTYPE_CHANNEL_W, 11)
		return true
	end
end
(works)
 


Script
Code:
function onSay(cid, words, param, channel)
    if channel == 11 then
        doPlayerSendChannelMessage(cid, 0, 'The skills are: ...', TALKTYPE_CHANNEL_W, 11)
        return true
    end
end

talkactions.xml:
Code:
    <talkaction words="skills" hide="yes" event="script" value="talentsk.lua"/>
 
Last edited by a moderator:
One prob, why is'nt this working? ;/

talkactions/scripts/talentskills.lua:

Code:
 function onSay(cid, words, param, channel)
    if channel == 11 then
        if getPlayerStorageValue(cid, 2191, -1) then
        if getPlayerStorageValue(cid, 2115) >= 1 then
            setPlayerStorageValue(cid, 2191, 1)
            setPlayerStorageValue(cid, 2115, getPlayerStorageValue(cid,2115)-1)
            setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+50)
            doPlayerSendChannelMessage(cid, 0, "You just used talent points for Extra Health.", TALKTYPE_CHANNEL_W, 11)
            return true
        else
            doPlayerSendChannelMessage(cid, 0, "Not enough talent points (1).", TALKTYPE_CHANNEL_W, 11)
            return true
            end
    end
end
end

talkactions/talkactions.xml:

Code:
    <talkaction words="extra health" hide="yes" event="script" value="talentskills.lua"/>
 
Last edited by a moderator:

Similar threads

Back
Top