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

Exp Ring Problem

Misokoko

New Member
Joined
Mar 29, 2013
Messages
126
Reaction score
0
hello i got a problem with my exp ring when i equip or de equip it server got crash
my tfs 0.4 and the script in movements.xml :

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

and in scripts
Code:
local config = {

rate = 1.2, -- 1.2 =  faster than normal.
un_equip = 6300, -- Item ID of the UN-Equipped ring.
equip = 6301 -- Item ID of the Equipped ring.

}

function onDeEquip(cid, item, slot)
doPlayerSetExperienceRate(cid, 1.0)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.")
doTransformItem(item.uid, config.un_equip)
return true
end

function onEquip(cid, item, slot)
if getConfigValue("experienceStages") == "yes" then
doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid))*1.2)
else
doPlayerSetExperienceRate(cid, getConfigValue("rateExperience")*1.2)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has been activated! It is now doubled your former experience rate.")
doTransformItem(item.uid, config.equip)
doDecayItem(item.uid)
return true
end
and sometimes igot this only error in console :
[Error - ItemSpawnEvent::configureRaidEvent] id (or name) tag missing for itemspawn event.
[Error - ItemSpawnEvent::configureRaidEvent] id (or name) tag missing for itemspawn event.
 
BUMP !! i think this problem can't be solved So Can Someone make script like that in actions when use an item gives exp rate for 1 hour ?
 
Copy all codes again, very carefully. Becouse they works ok on my 0.4 and doesn't crash server at all.
If you still getting crashes tell me what is your 0.4's build. If it's the latest, then problem may be in different place. Like not configured stages.xml where there's no value in one place and server is returning nil, and then it's trying to set player's exp rate to nil or so.

Movements.xml:
Code:
    <movevent type="Equip" itemid="6300" slot="ring" event="script" value="expring.lua"/>
    <movevent type="Equip" itemid="6301" slot="ring" event="script" value="expring.lua"/>
    <movevent type="DeEquip" itemid="6301" slot="ring" event="script" value="expring.lua"/>
expring.lua:
Code:
local config = {

rate = 1.2, -- 1.2 =  faster than normal.
un_equip = 6300, -- Item ID of the UN-Equipped ring.
equip = 6301 -- Item ID of the Equipped ring.

}

function onDeEquip(cid, item, slot)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.")
    doTransformItem(item.uid, config.un_equip)
    if getConfigValue("experienceStages") == "yes" then
        doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid)))
    else
        doPlayerSetExperienceRate(cid, getConfigValue("rateExperience"))
    end
    --print("printed onDeEquip")
    return true
end

function onEquip(cid, item, slot)
    if getConfigValue("experienceStages") == "yes" then
        doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid))*1.2)
    else
        doPlayerSetExperienceRate(cid, getConfigValue("rateExperience")*1.2)
    end
    --print("printed onEquip")
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has been activated! It is now doubled your former experience rate.")
    doTransformItem(item.uid, config.equip)
    return true
end
Items.xml:
Code:
    <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="0" />
    </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="armor" value="1" />
        <attribute key="skillShield" value="-10" />
        <attribute key="showduration" value="1" />
    </item>
 
Copy all codes again, very carefully. Becouse they works ok on my 0.4 and doesn't crash server at all.
If you still getting crashes tell me what is your 0.4's build. If it's the latest, then problem may be in different place. Like not configured stages.xml where there's no value in one place and server is returning nil, and then it's trying to set player's exp rate to nil or so.

Movements.xml:
Code:
    <movevent type="Equip" itemid="6300" slot="ring" event="script" value="expring.lua"/>
    <movevent type="Equip" itemid="6301" slot="ring" event="script" value="expring.lua"/>
    <movevent type="DeEquip" itemid="6301" slot="ring" event="script" value="expring.lua"/>
expring.lua:
Code:
local config = {

rate = 1.2, -- 1.2 =  faster than normal.
un_equip = 6300, -- Item ID of the UN-Equipped ring.
equip = 6301 -- Item ID of the Equipped ring.

}

function onDeEquip(cid, item, slot)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has ended.")
    doTransformItem(item.uid, config.un_equip)
    if getConfigValue("experienceStages") == "yes" then
        doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid)))
    else
        doPlayerSetExperienceRate(cid, getConfigValue("rateExperience"))
    end
    --print("printed onDeEquip")
    return true
end

function onEquip(cid, item, slot)
    if getConfigValue("experienceStages") == "yes" then
        doPlayerSetExperienceRate(cid, getExperienceStage(getPlayerLevel(cid))*1.2)
    else
        doPlayerSetExperienceRate(cid, getConfigValue("rateExperience")*1.2)
    end
    --print("printed onEquip")
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your extra experience rate has been activated! It is now doubled your former experience rate.")
    doTransformItem(item.uid, config.equip)
    return true
end
Items.xml:
Code:
    <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="0" />
    </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="armor" value="1" />
        <attribute key="skillShield" value="-10" />
        <attribute key="showduration" value="1" />
    </item>
if i touched the ring the server crashs i got it from here https://otland.net/threads/8-60-the-forgotten-server-0-4.240240/
 
It's build over 3777. People around Otland were reporing crashes while onEquip function is executed in 3777.

You can temporary change your expring.lua to this code, to see whather it will crash too.
If you get crash, this will mean that only solution is source edit or changing server's rev.

Code:
function onDeEquip(cid, item, slot)
    doCretureSay(cid, "Hello deequip", 1)
    return true
end

function onEquip(cid, item, slot)
    doCretureSay(cid, "Hello equip", 1)
    return true
end

Anyway, I recommend to you to upgrade your server to atleast 0.4 rev 3884.
 
It's build over 3777. People around Otland were reporing crashes while onEquip function is executed in 3777.

You can temporary change your expring.lua to this code, to see whather it will crash too.
If you get crash, this will mean that only solution is source edit or changing server's rev.

Code:
function onDeEquip(cid, item, slot)
    doCretureSay(cid, "Hello deequip", 1)
    return true
end

function onEquip(cid, item, slot)
    doCretureSay(cid, "Hello equip", 1)
    return true
end

Anyway, I recommend to you to upgrade your server to atleast 0.4 rev 3884.
okey and how i upgrade it ! u got one !?
 

Similar threads

Back
Top