• 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 Talkaction. How i can write one script with some words

This on Example.


Lua:
function onSay(cid,words,param,channel)
	if words == 'Blablabla' and channel == # then -- change # to your trade channel number, channels.xml.
		doThings()
	else
		doThings()
	end
	return true
end
 
Yes thanks rep++ for u but can u help me with the last one problem??

function onSay(cid,words,param)
if words == 'blabla' then
doThings(..)
else
doOtherThings(..)
end
return true
end
this word blabla would work only if i register it in talkactions.xml

but all words different than blabla i have to register too... ;/ how to fix it :S

i want to send message if creatuyre say different word than blabla without registering them all
 
This will work with ANY words, and you can choose your colors aswell! :p

Enjoy.
Lua:
function onSay(cid, words, param)
    if getPlayerGroupId(cid) == 2 or getPlayerGroupId(cid) == 3 and param ~= nil then
        local textColor = MESSAGE_EVENT_ADVANCE
        local setColor = FALSE
        if string.find(param," ",string.find(param,"[red,white,white2,orange,green,small,blue,red2]")+1) ~= nil then            
            color = string.sub(param,0,string.find(param," ")-1)
            if color == "red" then
                textColor = MESSAGE_STATUS_WARNING
                setColor = TRUE
            elseif color == "white" then
                textColor = MESSAGE_EVENT_ADVANCE
                setColor = TRUE
            elseif color == "white2" then
                textColor = MESSAGE_EVENT_DEFAULT
                setColor = TRUE
            elseif color == "orange" then
                textColor = 17
                setColor = TRUE
            elseif color == "green" then
                textColor = MESSAGE_INFO_DESCR
                setColor = TRUE
            elseif color == "small" then
                textColor = MESSAGE_STATUS_SMALL
                setColor = TRUE
            elseif color == "blue" then
                textColor = MESSAGE_STATUS_CONSOLE_BLUE
                setColor = TRUE
            elseif color == "red2" then
                textColor = MESSAGE_STATUS_CONSOLE_RED
                setColor = TRUE
            end
        end
        if setColor == TRUE then
            broadcastMessage(string.sub(param,string.find(param," ")+1,string.len(param)),textColor)
        else
            broadcastMessage(param,textColor)
        end
 
Back
Top