FabianoBN
l|¬¬"|l
TFS 0.3.7_SVN
This Script is to give a random text and if the first text leaving it removes the item.
But I get this error:
This is the line:
And this line also returns the error:
This Script is to give a random text and if the first text leaving it removes the item.
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local text = {"Ok!", "I go!", "No No No."}
if text[1,#text] ~= nil then
local texts = text[1, #text][math.random(#text[1, #text])]
if texts == text[1] then
doRemoveItem(cid, itemEx.uid,1)
doPlayerSendTextMessage(toPosition, "Break", TEXTCOLOR_ORANGE)
else
doPlayerSendTextMessage(toPosition, ""..random.."", TEXTCOLOR_ORANGE)
end
return TRUE
end
But I get this error:
Lua:
ERROR: untitled.lua:3: ']' expected near ','
This is the line:
Lua:
if text[1,#text] ~= nil then
And this line also returns the error:
Lua:
local texts = text[1, #text][math.random(#text[1, #text])]
Last edited: