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

TFS 0.X Action - Restrict use item by storage value

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,402
Solutions
17
Reaction score
150
Location
Brazil
Hi guys,

I have this action

Lua:
local config = {
    effectonuse = 28, -- effect (/z)
    levelsdodge = 100,  --- Maximum dodge you can use
    storagedodge = 48902 -- storage verification
}
   
function onUse(cid, item, frompos, item2, topos)
    if getPlayerStorageValue(cid, config.storagedodge) < config.levelsdodge then
        doRemoveItem(item.uid, 1)
        doSendMagicEffect(topos,config.effectonuse)
        doPlayerSendTextMessage(cid,22,"You've advanced your dodge skill to ["..(getPlayerStorageValue(cid, config.storagedodge)+1).."/100].")
        setPlayerStorageValue(cid, config.storagedodge, getPlayerStorageValue(cid, config.storagedodge)+1)
    elseif getPlayerStorageValue(cid, config.storagedodge) >= config.levelsdodge then
        doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of dodge skill.\nCongratulations!!!!")
    return 0
    end
return 1
end

I want to restrict the use of the item to the player who has storage 176602 with value greater than 75. So:

If storage 176602 > 75 (use ok)
If storage 176602 < 75 (message: u need at least 75 task points)
 
Solution
Solved importing a lib from my task mod.

Lua:
local config = {    effectonuse = 28, -- effect (/z)    levelsdodge = 100, --- Maximum dodge you can use   
 storagedodge = 48902 -- storage verification } 
domodlib('task_func') function onUse(cid, item, frompos, item2, topos)    local need = 75    if getTaskPoints(cid) < need then        doPlayerSendTextMessage(cid,22,"You need at least 75 task points") return true    elseif getPlayerStorageValue(cid, config.storagedodge) >= config.levelsdodge then        doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of dodge skill.\nCongratulations!!!!") return true    end    doRemoveItem(item.uid, 1)    doSendMagicEffect(topos,config.effectonuse)...
Solved importing a lib from my task mod.

Lua:
local config = {    effectonuse = 28, -- effect (/z)    levelsdodge = 100, --- Maximum dodge you can use   
 storagedodge = 48902 -- storage verification } 
domodlib('task_func') function onUse(cid, item, frompos, item2, topos)    local need = 75    if getTaskPoints(cid) < need then        doPlayerSendTextMessage(cid,22,"You need at least 75 task points") return true    elseif getPlayerStorageValue(cid, config.storagedodge) >= config.levelsdodge then        doPlayerSendTextMessage(cid,22,"You've already reached the MAX level of dodge skill.\nCongratulations!!!!") return true    end    doRemoveItem(item.uid, 1)    doSendMagicEffect(topos,config.effectonuse)    doPlayerSendTextMessage(cid,22,"You've advanced your dodge skill to ["..(getPlayerStorageValue(cid, config.storagedodge)+1).."/100].")    setPlayerStorageValue(cid, config.storagedodge, getPlayerStorageValue(cid, config.storagedodge)+1)    return true end
 
Solution
Back
Top