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

add five seconds exhausted lever.

ikaro22

New Member
Joined
Dec 17, 2019
Messages
22
Reaction score
0
Good night, I would like anyone who can help me to add the exhausted five seconds in which the lever id is 10029, I want it to become 10030 (not being able to use it while in 10030), having to wait five seconds to go back to id 10029 and be able to buy the item.


Lua:
local config = {
money = 35000000,
item = 9693,
count = 1,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
pos = getCreaturePosition(cid)

if item.itemid == 1945 then
if doPlayerRemoveMoney(cid, config.money) == TRUE then
doPlayerAddItem(cid, config.item, config.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "you buy "..config.count.." "..getItemNameById(config.item)..".")
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Not found.")
doSendMagicEffect(pos, CONST_ME_POFF)
end
end

end
 
Solution
Try this

Lua:
local config = {
money = 35000000,
item = 9693,
count = 1,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

local storage = 1500
local time = 5

    if exhaustion.check(cid, storage) then
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return doPlayerSendCancel(cid, "You are exhausted.")
    end

pos = getCreaturePosition(cid)

if item.itemid == 1945 then
if doPlayerRemoveMoney(cid, config.money) == TRUE then
doPlayerAddItem(cid, config.item, config.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "you buy "..config.count.." "..getItemNameById(config.item)..".")
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
exhaustion.set(cid, storage, time)
else
doPlayerSendTextMessage(cid...
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
local config = {
money = 35000000,
item = 9693,
count = 1,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
pos = getCreaturePosition(cid)

if item.itemid == 1945 then
if doPlayerRemoveMoney(cid, config.money) == TRUE and getCreatureCondition(player, CONDITION_EXHAUST) == TRUE then
doPlayerAddItem(cid, config.item, config.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "you buy "..config.count.." "..getItemNameById(config.item)..".")
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Not found.")
doSendMagicEffect(pos, CONST_ME_POFF)
end
end

end
 
Was it working before my edits? Any console error? TFS version? and also try this.
Lua:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, 5000)
local config = {
money = 35000000,
item = 9693,
count = 1,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
pos = getCreaturePosition(cid)

if(hasCondition(cid, CONDITION_EXHAUST)) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
    return true
end

if item.itemid == 1945 then
if doPlayerRemoveMoney(cid, config.money) == TRUE then
doPlayerAddItem(cid, config.item, config.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "you buy "..config.count.." "..getItemNameById(config.item)..".")
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Not found.")
doSendMagicEffect(pos, CONST_ME_POFF)
end
end

end
 
I'm buy for six addon doll
11:49 you buy 1 Addon Doll.
11:49 you buy 1 Addon Doll.
11:49 you buy 1 Addon Doll.
11:49 you buy 1 Addon Doll.
11:49 you buy 1 Addon Doll.
11:49 you buy 1 Addon Doll.
 
Try this

Lua:
local config = {
money = 35000000,
item = 9693,
count = 1,
}

function onUse(cid, item, fromPosition, itemEx, toPosition)

local storage = 1500
local time = 5

    if exhaustion.check(cid, storage) then
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return doPlayerSendCancel(cid, "You are exhausted.")
    end

pos = getCreaturePosition(cid)

if item.itemid == 1945 then
if doPlayerRemoveMoney(cid, config.money) == TRUE then
doPlayerAddItem(cid, config.item, config.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "you buy "..config.count.." "..getItemNameById(config.item)..".")
doSendMagicEffect(pos, CONST_ME_MAGIC_BLUE)
exhaustion.set(cid, storage, time)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Not found.")
doSendMagicEffect(pos, CONST_ME_POFF)
end
end

end
 
Last edited:
Solution
You have a typo
Lua:
local time = 1 — 1 sec
Change it to
Lua:
local time = 5
 
I didn't mean 1 or 5, I meant this one 1 — 1 sec
It will return an error unexpected symbol
Its all good, You are helping and that is really appreciated, not trying to judge you.
 
Back
Top