• 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 SSA and Might Ring not work after add exausted

zexus

Member
Joined
Oct 1, 2016
Messages
133
Reaction score
18
I'm using this scripts to exausted on SSA/Might Ring:

Code:
    <!-- onequip_exausted_pvp -->
<movevent type="Equip" itemid="2197" slot="necklace" event="script" value="onequip_exausted_pvp/ssa_exhaust.lua"/>
<movevent type="DeEquip" itemid="2197" slot="necklace" event="script" value="onequip_exausted_pvp/ssa_exhaust.lua"/>

<movevent type="Equip" itemid="2164" slot="ring" event="script" value="onequip_exausted_pvp/mightring_exhaust.lua"/>
<movevent type="DeEquip" itemid="2164" slot="ring" event="script" value="onequip_exausted_pvp/mightring_exhaust.lua"/>

ssa_exhaust.lua
Code:
local exhaustTime = 6 -- How many seconds of exhaust between equipping

function onEquip(cid, item, slot)
    if item.uid ~= 0 then
  
        if tonumber(getItemAttribute(item.uid, "equipped")) and tonumber(getItemAttribute(item.uid, "equipped")) == 1 then
            return true
        end

        if getCreatureStorage(cid, "ssaexhaust") < os.time() then
            callFunction(cid, item.uid, slot, false)
            doCreatureSetStorage(cid, "ssaexhaust", os.time() + exhaustTime)
            doItemSetAttribute(item.uid, "equipped", 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may not equip an ssa for " .. getCreatureStorage(cid, "ssaexhaust") - os.time() .. " seconds.")
            return false
        end
    end
    return true
end

function onDeEquip(cid, item, slot)
    callFunction(cid, item.uid, slot, false)
    doItemSetAttribute(item.uid, "equipped", -1)
    return true
end

mightring_exhaust.lua
Code:
local exhaustTime = 6 -- How many seconds of exhaust between equipping

function onEquip(cid, item, slot)
    if item.uid ~= 0 then
  
        if tonumber(getItemAttribute(item.uid, "equipped")) and tonumber(getItemAttribute(item.uid, "equipped")) == 1 then
            return true
        end

        if getCreatureStorage(cid, "mightringexhaust") < os.time() then
            callFunction(cid, item.uid, slot, false)
            doCreatureSetStorage(cid, "mightringexhaust", os.time() + exhaustTime)
            doItemSetAttribute(item.uid, "equipped", 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may not equip an might ring for " .. getCreatureStorage(cid, "mightringexhaust") - os.time() .. " seconds.")
            return false
        end
    end
    return true
end

function onDeEquip(cid, item, slot)
    callFunction(cid, item.uid, slot, false)
    doItemSetAttribute(item.uid, "equipped", -1)
    return true
end

But somehow it brokes the defense scripts and its not even removing the charges...
Did u guys know why?
 
Solution
You just want to use the onEquip function in movements.xml
Code:
<movevent event="Equip" itemid="2197" slot="necklace" script="ssa.lua" function="onEquipItem" />
then go to movements/script/ssa.lua and use this script
Code:
        -- <!-- Made By Nemo -->
local exhaustTime  = 2 -- time in seconds
local exhuststorage = 200001
function onEquip(cid, item, slot)
        if getCreatureStorage(cid, exhuststorage) <= 0 then
        addEvent(setPlayerStorageValue,1,cid,exhuststorage,1)
        addEvent(setPlayerStorageValue,exhaustTime * 1000,cid,exhuststorage,-1)
        return true
        end
            if getCreatureStorage(cid, exhuststorage) >= 1 then
            doPlayerSendCancel(cid, "You are exhausted.")
            return false...
You just want to use the onEquip function in movements.xml
Code:
<movevent event="Equip" itemid="2197" slot="necklace" script="ssa.lua" function="onEquipItem" />
then go to movements/script/ssa.lua and use this script
Code:
        -- <!-- Made By Nemo -->
local exhaustTime  = 2 -- time in seconds
local exhuststorage = 200001
function onEquip(cid, item, slot)
        if getCreatureStorage(cid, exhuststorage) <= 0 then
        addEvent(setPlayerStorageValue,1,cid,exhuststorage,1)
        addEvent(setPlayerStorageValue,exhaustTime * 1000,cid,exhuststorage,-1)
        return true
        end
            if getCreatureStorage(cid, exhuststorage) >= 1 then
            doPlayerSendCancel(cid, "You are exhausted.")
            return false
            end
end
now go to creaturescripts/scripts/login.lua and add
Code:
   if getPlayerStorageValue(cid, 200001) >= 0 then
setPlayerStorageValue(cid,200001,-1) -- ssa system
end
i did not test it but it should work fine
 
Last edited:
Solution
You just want to use the onEquip function in movements.xml
Code:
<movevent event="Equip" itemid="2197" slot="necklace" script="ssa.lua" function="onEquipItem" />
then go to movements/script/ssa.lua and use this script
Code:
        -- <!-- Made By Nemo -->
local exhaustTime  = 2 -- time in seconds
local exhuststorage = 200001
function onEquip(cid, item, slot)
        if getCreatureStorage(cid, exhuststorage) <= 0 then
        addEvent(setPlayerStorageValue,1,cid,exhuststorage,1)
        addEvent(setPlayerStorageValue,exhaustTime * 1000,cid,exhuststorage,-1)
        return true
        end
            if getCreatureStorage(cid, exhuststorage) >= 1 then
            doPlayerSendCancel(cid, "You are exhausted.")
            return false
            end
end
now go to creaturescripts/scripts/login.lua and add
Code:
   if getPlayerStorageValue(cid, 200001) >= 0 then
setPlayerStorageValue(cid,200001,-1) -- ssa system
end
i did not test it but it should work fine

looks like it is working but how to show how many time left to the players?

Code:
-- <!-- Made By Nemo -->
local exhaustTime  = 5 -- time in seconds
local exhaustStorage = 200001
function onEquip(cid, item, slot)
    if getCreatureStorage(cid, exhaustStorage) <= 0 then
        addEvent(setPlayerStorageValue,1,cid,exhaustStorage,1)
        addEvent(setPlayerStorageValue,exhaustTime * 1000,cid,exhaustStorage,-1)
        return true
    end
    if getCreatureStorage(cid, exhaustStorage) >= 1 then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You may not equip an SSA for " .. getCreatureStorage(cid, exhaustStorage) .. " seconds.")
        return false
    end
end
 
Code:
        -- <!-- Made By Nemo -->
local exhaustTime  = 5 -- time in seconds
local exhuststorage = 200001 -- empty storage
function onEquip(cid, item, slot)
            if (getPlayerStorageValue(cid, exhuststorage) > os.time()) then
doPlayerSendCancel(cid, "You must wait another " .. getPlayerStorageValue(cid, exhuststorage) - os.time() .. ' second' .. ((getPlayerStorageValue(cid, exhuststorage) - os.time()) == 1 and "" or "s") .. ".")
return false
end
        addEvent(setPlayerStorageValue,1,cid,exhuststorage,os.time() + exhaustTime)
        return true
end
well this script will show how much time he is exhausted. sorry i did not read that you need time show
 
Back
Top