• 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 Exp ring - problem with duration (countdown doesnt work)

kacpersky

Mr. Brightside
Joined
Jan 25, 2009
Messages
499
Reaction score
3
all works fine, but i have one problem with duration, all time is 8 minutes. After 8 min using, ring still has 8 min. Somebody knows how to repair it ?

items.xml
PHP:
	<item id="6300" article="a" name="death ring">
		<attribute key="weight" value="80"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="transformEquipTo" value="6301"/>
		<attribute key="stopduration" value="1"/>
		<attribute key="showduration" value="1"/>
	</item>
	<item id="6301" article="a" name="death ring">
		<attribute key="weight" value="80"/>
		<attribute key="slotType" value="ring"/>
		<attribute key="decayTo" value="0"/>
		<attribute key="transformDeEquipTo" value="6300"/>
		<attribute key="duration" value="480"/>
		<attribute key="showduration" value="1"/>
	</item>

movements.xml:
PHP:
	<movevent type="Equip" itemid="6301" slot="ring" event="function" value="onEquipItem"/>
	<movevent type="Equip" itemid="6300" slot="ring" event="script" value="script.lua"/>
	<movevent type="DeEquip" itemid="6301" slot="ring" event="script" value="script.lua"/>

script.lua:
PHP:
-- Credits: Slawkens & Barker 
local config = { 
    rate = 1.5,
} 

function onDeEquip(cid, item, slot) 
    if(item.itemid == 6301) then 
        doPlayerSetExperienceRate(cid, 1.0) 
		   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.") 
			doTransformItem(item.uid, 6300) 
    end 
end 

function onEquip(cid, item, slot) 

    if(item.itemid == 6300) then 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has been activated! It is now: " .. config.rate .. "x doubled your former experience rate.") 
		    doPlayerSetExperienceRate(cid, config.rate) 
			doTransformItem(item.uid, 6301)
				return true
    end 
end
 
Back
Top Bottom