• 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 Double exp ring

tiddpd

PHP Scripter
Joined
Apr 16, 2008
Messages
331
Reaction score
0
Hello I am trying to make a exp rate ring, I am using the base of the following script on tfs 0.3.6, but the server crashses when the ring is equipped or de-equipped, its either at random.

However when it is equipped the exp rate does work, it just crashes when equipped or de-equipped.

LUA Code

Code:
-- Credits: Slawkens & Barker 

function onDeEquip(cid, item, slot) 
    if(item.itemid == 6301) then 
        doPlayerSetRate(cid, SKILL__LEVEL, 1)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Reg exp") 
 	doTransformItem(item.uid, 6300) 
    end 
end 

function onEquip(cid, item, slot) 

    if(item.itemid == 6300) then 
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Double exp.") 
	doPlayerSetRate(cid, SKILL__LEVEL, 2)
	doTransformItem(item.uid, 6301)
	return true
    end 
end

XML code:

Code:
<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"/>
 
Try changing

Code:
doPlayerSetRate(cid, SKILL__LEVEL, 2)

to

Code:
doPlayerSetExperienceRate(cid, 2)

and

Code:
doPlayerSetRate(cid, SKILL__LEVEL, 1)

to

Code:
doPlayerSetExperienceRate(cid, 2)

Tell me if it works,
else
I will try to do something else.
 
I did find a solution, its kind weird, but if I create the item with a GM and it automatically puts it into the ring slot and you DeEquip.. that = crash. But if you create the item and it goes to the backpack first, it will be fine.
 
Back
Top