• 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 On DeEquip exp ring bug

MadMOOK

Hoo
Joined
Apr 20, 2011
Messages
802
Reaction score
43
It Gives double exp like its supposed to, and goes back to normal like its supposed to..

But when i take ring off and put back on, it is 2x MORE than was first time..
Code:
 local config = {
    rate = 1,
    expstorage = 1102,
     register = 1202
}

function onEquip(cid, item, slot)
        local rates = getPlayerRates(cid)
        setPlayerStorageValue(cid, config.expstorage, rates[SKILL__LEVEL])
        setPlayerStorageValue(cid, config.register, 1)
        doTransformItem(item.uid, 2205)
        doDecayItem(item.uid)
        doPlayerSetExperienceRate(cid, rates[SKILL__LEVEL]+config.rate)
    return true
end
function onDeEquip(cid, item, slot)
        doTransformItem(item.uid, 2168)
            setPlayerStorageValue(cid, config.register, 0)
            local oldexp = getPlayerStorageValue(cid, config.expstorage)
            doPlayerSetExperienceRate(cid, oldexp)
return true
end
 
Last edited:
Not sure about other distros, but in TFS 1.0 the onEquip event is a little weird because it's called by the Player::__queryAdd() virtual method (it determines whether the item can be equipped or not) so it's most likely not possible to use it like that (you'd have to modify this Move Event so that it gets called when the item actually gets equipped).
 
it does that silly xD
the script works fine other than the fact it gives to much exp, and the rate it returns to when i remove ring is a bit higher than it should be..
 
its not a script, just read the post and do ur script

and no it is getting registered only one TIME. u dont even tryed it.
That just show us, that u didnt even read my post. this is the anwser u were looking. read this time carefully.
when u ll equip something, the server make 2 test before equip! [...] when
PHP:
getPlayerSlotItem(cid, slot )
will return [" we havent equiped it yet "]
to avoid the test and only run your script when the equipement is equiped!

use that code before ur script,
and it isnt using any storagevalue as people usualy does ( the easy way u call? )
PHP:
function onEquip(cid, item, slot)
    local slots = getPlayerSlotItem(cid, slot )
    if slots.itemid ~= item.itemid then
        return true
    end

   doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "hey")

return true
end
output : hey
1time
 

Similar threads

Back
Top