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

Lua onEquip not working (0.4)

Kahras

Member
Joined
Aug 6, 2012
Messages
101
Reaction score
7
Location
Warsaw
movements.xml:
Code:
<movevent type="Equip" itemid="12642" slot="armor" event="script" value="rdm.lua"/>

rdm.lua:
Code:
function onEquip(cid, item, slot)
    doPlayerAddItem(cid, 2160, 1)
return true
end

The problem is that during the setting of an item function is performed three times.
Gets 3 crystal cions ..
 
They also do not work because the function takes 3 times so you will want to take 6 cc, and he'll kick the error.

And it still is a test function because I'm going to do that gives% mana and life.
 
Code:
function onEquip(cid, item, slot)
    if getPlayerStorageValue(cid, 5012) == 0 then
    doPlayerAddItem(cid, 2160, 1)
    end
    doPlayerSetStorageValue(cid, 5012,1)
return true
end
this is just a workaround
 
movements.xml:
Code:
<movevent type="Equip" itemid="12642" slot="armor" event="script" value="rdm.lua"/>

rdm.lua:
Code:
function onEquip(cid, item, slot)
    doPlayerAddItem(cid, 2160, 1)
return true
end

The problem is that during the setting of an item function is performed three times.
Gets 3 crystal cions ..

https://github.com/otland/forgottenserver/issues/278

like this~

function onEquip(cid, item, slot)
local slots = getPlayerSlotItem(cid, slot )
if slots.itemid ~= item.itemid then
return true
end

doPlayerAddItem(cid, 2160, 1)
return true
end

//
just check this page if doesn't work properly.
http://otland.net/threads/tfs-1-0-movement-loops-3-times.209686/#post-2009551
 
Back
Top