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

a noob problem with talkactions 10.9

Dextruk

New Member
Joined
Jan 11, 2015
Messages
3
Reaction score
0
hello otland community, i think i have a noob problem with talk actions on my OT, the problem is that: at the moment i use "/ i 2160" with my god character it does not work..
Same with, "/ m, / clean, / ghost, /s" etc...
and "/a 1, /up,/down" they work normally..

thanks in advance




create_item.lua
Code:
function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local split = param:split(",")

    local itemType = ItemType(split[1])
    if itemType:getId() == 0 then
        itemType = ItemType(tonumber(split[1]))
        if itemType:getId() == 0 then
            player:sendCancelMessage("There is no item with that id or name.")
            return false
        end
    end

    local count = tonumber(split[2])
    if count ~= nil then
        if itemType:isStackable() then
            count = math.min(10000, math.max(1, count))
        elseif not itemType:isFluidContainer()  then
            count = math.min(100, math.max(1, count))
        else
            count = math.max(0, count)
        end
    else
        count = itemType:isFluidContainer() and 0 or 1
    end

    local result = player:addItem(itemType:getId(), count)
    if result ~= nil then
        if not itemType:isStackable() then
            if type(result) == "table" then
                for i = 1, #result do
                    result[i]:decay()
                end
            else
                result:decay()
            end
        end
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    end
    return false
end

talkactions.xml
Code:
<talkaction words="/i" separator=" " script="create_item.lua" />
 
Don't use the space after the /. Do like "/m demon" "/clean" "/ghost" etc. If im not mistaken the seperator is used for after the talkaction words for instance /m'seperator'demon.
 
Back
Top