• 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 Exausted SSA/Might Ring

eyez

Member
Joined
Oct 11, 2016
Messages
129
Reaction score
19
I did found this script to add a exausted on SSA and Might Ring (to prevent bots rulles)
It's working, you cant equip the item before exausted finish

But SSA and Might Ring are not losing charges after u recive damage (after i added this script)

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
Code:
local storage = 9500
local fixStorage = 8000
local time = 4
function onEquip(cid, item, slot, boolean)
    if getPlayerStorageValue(cid, fixStorage) == 1 then
        doPlayerSetStorageValue(cid, fixStorage, -1)
        return callFunction(cid, item.uid, slot, boolean)
    end
    if getPlayerStorageValue(cid, storage) >= os.time() then
        print("exhausted")
        return false
    end
    doPlayerSetStorageValue(cid, storage, os.time() + time)
    doPlayerSetStorageValue(cid, fixStorage, 1)
    print("exhaustion set for 5 seconds")
    return true
end
function onDeEquip(cid, item, slot, boolean)
    return callFunction(cid, item.uid, slot, boolean)
end

mightring
Code:
local storage = 9501
local fixStorage = 8001
local time = 4
function onEquip(cid, item, slot, boolean)
    if getPlayerStorageValue(cid, fixStorage) == 1 then
        doPlayerSetStorageValue(cid, fixStorage, -1)
        return callFunction(cid, item.uid, slot, boolean)
    end
    if getPlayerStorageValue(cid, storage) >= os.time() then
        print("exhausted")
        return false
    end
    doPlayerSetStorageValue(cid, storage, os.time() + time)
    doPlayerSetStorageValue(cid, fixStorage, 1)
    print("exhaustion set for 5 seconds")
    return true
end
function onDeEquip(cid, item, slot, boolean)
    return callFunction(cid, item.uid, slot, boolean)
end
 
I used the default fonts and it works with this script:
try it and tell me.

movements.xml
Code:
<movevent type="Equip" itemid="2197" slot="necklace" event="script" value="stoneSkinAmulet.lua"/>
<movevent type="DeEquip" itemid="2197" slot="necklace" event="script" value="stoneSkinAmulet.lua"/>

stoneSkinAmulet.lua
Code:
function onEquip(cid, item, slot, boolean)
    if getCreatureStorage(cid, 1000) > os.time() then
        return false
    end
    doCreatureSetStorage(cid, 1000, os.time() + 6)
    return callFunction(cid, item.uid, slot, false)
end

function onDeEquip(cid, item, slot, boolean)
    return callFunction(cid, item.uid, slot, boolean)
end

I do not know if I am misunderstanding something in this thread.
 
Last edited:
I used the default fonts and it works with this script:
try it and tell me.

movements.xml
Code:
<movevent type="Equip" itemid="2197" slot="necklace" event="script" value="stoneSkinAmulet.lua"/>
<movevent type="DeEquip" itemid="2197" slot="necklace" event="script" value="stoneSkinAmulet.lua"/>

stoneSkinAmulet.lua
Code:
function onEquip(cid, item, slot, boolean)
    if getCreatureStorage(cid, 1000) > os.time() then
        return false
    end
    doCreatureSetStorage(cid, 1000, os.time() + 6)
    return callFunction(cid, item.uid, slot, false)
end

function onDeEquip(cid, item, slot, boolean)
    return callFunction(cid, item.uid, slot, boolean)
end

I do not know if I am misunderstanding something in this thread.
Returning false in onEquip/onDeEquip scripts doesn't stop the item from equipping/de-equipping.
The server has already decided that the item is going to be equipped/de-equipped and wants you to tell it if there is something extra that should happen at that point.
 
Returning false in onEquip/onDeEquip scripts doesn't stop the item from equipping/de-equipping.
The server has already decided that the item is going to be equipped/de-equipped and wants you to tell it if there is something extra that should happen at that point.
but this works well.

36885
When returning false the item is not equipped.
 
By using:
Code:
local exhaust = 5 --seconds
local eStorage = 55510
function onEquip(cid, item, slot, boolean)
    if getCreatureStorage(cid, eStorage) > os.time() then
        return false
    end
    doCreatureSetStorage(cid, eStorage, os.time() + exhaust)
    return callFunction(cid, item.uid, slot, false)
end

function onDeEquip(cid, item, slot, boolean)
    return callFunction(cid, item.uid, slot, boolean)
end

Guys, thank you so much to try help us, i found a lot ppl search for something like this
---

When i try to equip the SSA in a empty amulet slot shows me:
Cancelmsg: There is not enought room.
 
@eyez it is very likely that you are generating some error in the console, if that is the case, do not hesitate to publish the errors, it may be due to a nonexistent function, it may be that
Code:
getCreatureStorage
is not the way to get storages on your server, which is strange, the code is tested in
Code:
The Forgotten Server, version 0.3.6 (Crying Damson)
 
@eyez it is very likely that you are generating some error in the console, if that is the case, do not hesitate to publish the errors, it may be due to a nonexistent function, it may be that
Code:
getCreatureStorage
is not the way to get storages on your server, which is strange, the code is tested in
Code:
The Forgotten Server, version 0.3.6 (Crying Damson)

The strange thing is:
There is no errors on console

I'm using this: Fir3element/3777 (https://github.com/Fir3element/3777/tree/master/src)

With this scripts i can do equip SSA on hands, but on amulet slots shows There is not enought room.
 
- I've already tried to restart the storage, and event try to use another one

- My movemments.xml are:
Code:
<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"/>

- Which one should i use?

Should i use the original movemment.cpp

Or uses the @danielsalim1 one

???
 
I used the default fonts and it works with this script:
try it and tell me.

movements.xml
Code:
<movevent type="Equip" itemid="2197" slot="necklace" event="script" value="stoneSkinAmulet.lua"/>
<movevent type="DeEquip" itemid="2197" slot="necklace" event="script" value="stoneSkinAmulet.lua"/>

stoneSkinAmulet.lua
Code:
function onEquip(cid, item, slot, boolean)
    if getCreatureStorage(cid, 1000) > os.time() then
        return false
    end
    doCreatureSetStorage(cid, 1000, os.time() + 6)
    return callFunction(cid, item.uid, slot, false)
end

function onDeEquip(cid, item, slot, boolean)
    return callFunction(cid, item.uid, slot, boolean)
end

I do not know if I am misunderstanding something in this thread.
Maybe this really works, try using it without my modifications.
 
Maybe you miss this check, which is absurd for someone to remove it Fir3element/3777 (https://github.com/Fir3element/3777/blob/master/src/player.cpp#L2794)

What are u mean?
That my player.cpp don't have this line?

Code:
        if(!g_moveEvents->onPlayerEquip(const_cast<Player*>(this), const_cast<Item*>(item), (slots_t)index, true))
            return RET_CANNOTBEDRESSED;

Yes, it have:

The other guy is also having this problem :S

I'm sorry if i don't understand what u said, i'm dumb
 
Back
Top