• 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 Saving array in storage

Guiaki

Member
Joined
Jan 3, 2011
Messages
137
Reaction score
8
I was looking at an auto loot feature in otland:
http://otland.net/threads/mod-auto-loot.164289/
And I got myself to implement it basically everything, but there is one "bug" that doesn't give me an error or anything but simply won't work, look at this function:

Code:
function setPlayerStorageTable(cid, storage, tab)
   local tabstr = "&"
   for i,x in pairs(tab) do
      tabstr = tabstr .. i .. "," .. x .. ";"[/INDENT]
   end
   setPlayerStorageValue(cid, storage, tabstr:sub(1, #tabstr-1))[/INDENT]
end
Is it possible to save that array in TFS 1.0? I don't think its working, or need to change something perhaps.
 
looter = {}
looter[cid] = {2152, 2160, 2148, 2520}

table.insert(looter[cid], getItemIdByName(param))

if you use reload this will restart so consider loading these from database or file, for example:
!loot enable <- loads loot from file
!loot disable <- clears looter[cid] table without saving
!loot save <- saves player's configuration to file
!loot clear <- clears looter[cid] and saves to file
!loot add item name <- adds id to looter[cid]
!loot remove item name <- removes id from looter[cid]
 
Back
Top