• 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 TFS 0.3 - doCreateItem FUNCTION

Kuantikum

Member
Joined
Jul 3, 2015
Messages
219
Solutions
1
Reaction score
20
Hello guys!

Could someone instruct me if
Lua:
doCreateItem
works with
Lua:
table.random


Here is the a exemple im trying to do:
Lua:
 local dpitem = table.random({24710, 24711, 24712, 24710, 24711, 24712, 24710, 24711, 24712, 19839, 24710, 24711, 24712, 19832, 18945, 19851, 19852, 19833, 19853, 19854, 19829, 19855, 19856, 19830, 19857, 19837, 19858, 19834, 19831, 19859, 19836, 19860, 19835,})
                elseif (not doPlayerAddItem(cid, table.random({24710, 24711, 24712, 24710, 24711, 24712, 24710, 24711, 24712, 19839, 24710, 24711, 24712, 19832, 18945, 19851, 19852, 19833, 19853, 19854, 19829, 19855, 19856, 19830, 19857, 19837, 19858, 19834, 19831, 19859, 19836, 19860, 19835,}), math.random(1, 3), false)) then
                    doPlayerAddDepotItem(cid, 0, doCreateItem(dpitem, math.random(1, 3), getCreaturePosition(cid)))
                end

Can you help me?

Thx!
 
I don't think table.random is a function.

This code appears you are trying to give someone a random item, 1-3 of them, and if they can't be given the item, then that same item should go to their dp instead, correct?

If that is not your intention please say, because if it is, that code wouldn't work as intended even if table.random was a function.

Print(dpitem)

Add that to your code and see if it prints a random number, the number would not be the id of the item, it would be a small number between 0-# of items in list.

Does that print a random number?
 
Back
Top