• 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 How I do that?

Engradiel

Member
Joined
May 3, 2009
Messages
121
Reaction score
7
Location
Brazil
Lua:
-- Custom message matching callback function for requesting trade messages.
    function ShopModule.messageMatcher(keywords, message)
        for i, word in pairs(keywords) do
            if type(word) == "string" then
                if string.find(message, word) and not string.find(message, "[%w+]" .. word) and not string.find(message, word .. "[%w+]") then
                    return true
                end
            end
        end

        return false
    end

It's a npc function and I need to get the player, self or cid. But I can't.. Can some one help?
To get npc I know that uses: Creature(getNpcCid())
Buw How to get the player? ...

Please someone help me.
It's possible?
 
Haha. Sorry I am doing it of a wrong way.
I am creating a log in GM chat that say all information of things in server.
So when player buy something and npc, or sell or say with npc some msg is sended, like this:

Bot Quatro [279] selled 14x blue crystal splinter for 5600 gold on Loot Seller II
Luney Tunnes [675] buyed 1x great spirit potion for 190 gold on Magician Seller
Happy [615] send "!bless" to npc Token Buyer


So I was thinking to show msgs sended to npc in a wrong part of function..

I want to send this information off msgs sended of private. You know how I can do this in source?
 
I did this:

in modules.lua:

function ShopModule:callbackOnSell(cid, itemid, subType, amount, ignoreEquipped, _)
Lua:
    sendChannelMessage(41, TALKTYPE_CHANNEL_O, ""..player:getName().." ["..player:getLevel().."] selled "..amount.."x "..ItemType(itemid):getName().." for "..amount * shopItem.sell.." gold on "..Creature(getNpcCid()):getName().."")

function ShopModule:callbackOnBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
Lua:
sendChannelMessage(41, TALKTYPE_CHANNEL_Y, ""..player:getName().." ["..player:getLevel().."] buyed "..amount.."x "..ItemType(itemid):getName().." for "..totalCost.." gold on "..Creature(getNpcCid()):getName().."")


in keywordhandler.lua:
function KeywordHandler:processNodeMessage(node, cid, message)

Lua:
sendChannelMessage(41, TALKTYPE_CHANNEL_R1, ''..player:getName()..' ['..player:getLevel()..'] send "'..message..'" to npc '..Creature(getNpcCid()):getName()..'')

But this last is not working fine.
 
Back
Top