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

TFS 1.X+ client side but table.insert and = didn't do the job tfs 1.5

bpm91

Intermediate OT User
Joined
May 23, 2019
Messages
928
Solutions
7
Reaction score
127
Location
Brazil
YouTube
caruniawikibr
hey guys, im trying to send table children and indexes through opcodes to rebuild the table on client side but table.insert and = didn't do the job

TFS
Lua:
function parseOffers(cid, data, cat, y, i)
    addEvent(function(cid, data, y, i)
        local player = Player(cid)
        player:sendExtendedOpcode(ExtendedOPCodes.CODE_SPELLS_STORE, json.encode({action = "offers", data = {spellsData = data, y = y, i = i }}))
    end, 50, cid, data, y, i)
end


tfs

Lua:
function spellsStorePurchase(player, data)
local playerPos = player:getPosition()
local playerTile = Tile(playerPos)
     if not playerTile:hasFlag(TILESTATE_PROTECTIONZONE) then
        return errorMsg(player, "You need to be in Protection Zone to use it")
    end
    for i = 1,#categories do
        for y = 1,#spellsData[categories[i]] do
            if data == spellsData[categories[i]][y].name then
                if player:getMoney() >= spellsData[categories[i]][y].gold then
                    if player:getMagicLevel() >= spellsData[categories[i]][y].magicLevel then
                        if not player:hasLearnedSpell(spellsData[categories[i]][y].realName) then
                            if (player:getPremiumEndsAt() == true and spellsData[categories[i]][y].premium == true) or (spellsData[categories[i]][y].premium == false) then
                                if (player:getVocation():getId() > 4 and spellsData[categories[i]][y].promotion == true) or spellsData[categories[i]][y].promotion == false then
                                    player:learnSpell(spellsData[categories[i]][y].realName)
                                    return infoMsg(player, "You've learned spell " .. data .. "!", true)
                                    else
                                end
                            end
                        end
                    end
                end
            end
        end
    end
    return errorMsg(player, "Something went wrong, try again or contact server admin [data: "..data.."]!")
end



otc

Lua:
function onSpellsStoreFetchOffers(data)
    table.insert(spellsData[categories[data.i]][data.y], data.spellsData)
end
 
Back
Top