• 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 Why this script do not work?

1268995

Member
Joined
Sep 9, 2010
Messages
422
Reaction score
13
Code:
local sir_islam = {
exhausted = 1.5, -- Time you are exhausted. by second
storage = 90003 -- Storage used for "exhaust."
}

function onUse(cid, item, frompos, item2, topos)

    if((not(isKnight(item2.uid)) or getPlayerLevel(item2.uid) < 80) then

        doCreatureSay(item2.uid, "Only knights of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return TRUE
    end

if (getPlayerStorageValue(cid, sir_islam.storage) > os.time())then
return doPlayerSendCancel(cid,"Você deve esperar mais " .. getPlayerStorageValue(cid, sir_islam.storage) - os.time() .. ' segundos' .. ((getPlayerStorageValue(cid, sir_islam.storage) - os.time()) == 1 and "" or "s") .. ".")
end

playerpos = {x=topos.x, y=topos.y, z=topos.z, stackpos=253}
player = getThingfromPos(playerpos)
ml = getPlayerMagLevel(cid)
lvl = getPlayerLevel(cid)
formula = 1000
if item2.itemid == 1 and ml >= 1 then

doSendMagicEffect(getPlayerPosition(cid), 12)
doCreatureAddHealth(player.uid,formula)

setPlayerStorageValue(cid, sir_islam.storage, os.time() + sir_islam.exhausted)
end
return 1
end

The script work without this part:

Code:
    if((not(isKnight(item2.uid)) or getPlayerLevel(item2.uid) < 80) then

        doCreatureSay(item2.uid, "Only knights of level 80 or above may drink this fluid.", TALKTYPE_ORANGE_1)
        return TRUE
    end

No errors appear on console when i try using the item. Appear "sorry, not possible".
 
Oh, i had a wrong " ( "...

The right code is:

if(not(isKnight(item2.uid)) or getPlayerLevel(item2.uid) < 80) then

Solved!
 
Back
Top