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

How use "break" in a script?

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Why this question? because i want to know all about lua-scripts :].. to make better scripts.

How use the "break" in a script? i found it in this script(Made by Mazen-OTLand)

Code:
[COLOR="DarkSlateBlue"]function onUse(cid, item, fromPosition, itemEx, toPosition)
uniqueId = 18300
newid = 0
items = {
{2148, 50},
{2148, 80},
{9808, 1},
{7618, 1},
{9811, 1},
{2213, 1},
{2666, 8},
{2671, 5},
{2769, 5},
{2145, 2},
{5710, 1}
}
    for i = 1, 20 do
        if item.uid == (uniqueId+i) then
            newid = uniqueId+i
            [COLOR="Red"][B]break[/B][/COLOR]
        elseif i == 20 then
            return FALSE
        end
    end
    local crateStorage = getPlayerStorageValue(cid, newid)
    local randomize = math.random(1, 15)

    if crateStorage == -1 then
        for f, k in ipairs(items) do
            if f == randomize then
                if k[2] > 1 then
                    t = k[2]
                    s = "s"
                else
                    t = "a"
                    s = nil
                end
                doCreatureSay(cid, "You have found ".. t .." ".. getItemName(k[1]) .."".. s ..".", TALKTYPE_ORANGE_1)
                doPlayerAddItem(cid, k[1], k[2])
                setPlayerStorageValue(cid, newid, 1)
                return TRUE
            end
        end
        if crateStorage == -1 then
            doCreatureSay(cid, "You have not found anything useful.", TALKTYPE_ORANGE_1)
            setPlayerStorageValue(cid, newid, 1)
            return TRUE
        end
               
    else
        doCreatureSay(cid, "It is empty.", TALKTYPE_ORANGE_1)
    end
return TRUE
end[/COLOR]
 
Back
Top