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

Solved format a nil value? TFS 1.2 / otservbr

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,479
Solutions
9
Reaction score
209
hello folks, I can't figure out what is happening...
so, I use otservbr, or whatever, same with tfs 1.2
I want to chance some msg of loot with a chance...
Code:
local text = {}
            msgLoot = {}
            if self:getName():lower() == (Game.getBoostedCreature()):lower() then
                 text = ("Loot of %s: %s (boosted loot)"):format(mType:getNameDescription(), corpse:getContentDescription())
            else
                text = (msgLoot):format(mType:getNameDescription(), corpse:getContentDescription())
            end
the script that calculate the chance...
Code:
local pob = math.random(0, 100)
            if (prob < 20) then
                msgLoot = "Saque bla bla bla %s: %s ("
                break
            else
                msgLoot = "Loot of %s: %s"
            end
1626864472293.png
I'm getting this error, yesterday this sh*t works fine, but today don't? WHY?
 

Alpha

Relentless
Joined
Apr 3, 2011
Messages
667
Solutions
36
Reaction score
481
Location
South Korea
You make msgLoot a table with msgLoot = {} and then 4 lines below that, you try to call format on it, which isn't going to work. msgLoot needs to be a string.
 
OP
OP
silveralol

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,479
Solutions
9
Reaction score
209
You make msgLoot a table with msgLoot = {} and then 4 lines below that, you try to call format on it, which isn't going to work. msgLoot needs to be a string.
So, to fix It should I use
Code:
msgLoot = ""
or what?
First time that I use format function in my ideas...
 
Top