• 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 Item which give skill rate crash server

metiu11

Member
Joined
Mar 26, 2011
Messages
94
Solutions
2
Reaction score
5
TFS 0.3.6
Hello, i found this script which give skill rate to player.
The problem is when player get this item from chest if he have free necklace slot, it will be placed there.
Then if player want to take off amulet server crashed... can someone help us? :)

Lua:
--Credits to MadMook and Limos for the return trues(what would i do without limos xD)--
-- Remove the "--" if you want premium or level restriction

--if you add an if then add an end!

function onEquip(cid, item, slot)
--    if isPremium(cid) then
--    if getPlayerLevel(cid) >= 8 then
    doPlayerSetSkills(cid, 2.5)
--    end
--    end
        return true
end
function onDeEquip(cid, item, slot)
--    if isPremium(cid) then
        doPlayerSetSkills(cid, 2.0)
--    else
--        doPlayerSetSkills(cid, 1.0)
--    end
return true
end
 
@gicu0770
If you don't have some function in server you will get information in console, not crash. xd
@topic
This is problem with engine, you will try add this item in any container.
If you get item to backpack this will work fine.

btw.. If you get item in slot(necklace) and you have this in movement.xml, you cannot get it off and look on it(IF you use custom script).

You can try fix it use debugger (example: gdb in linux) and track error.
 
@gicu0770
If you don't have some function in server you will get information in console, not crash. xd
@topic
This is problem with engine, you will try add this item in any container.
If you get item to backpack this will work fine.

btw.. If you get item in slot(necklace) and you have this in movement.xml, you cannot get it off and look on it(IF you use custom script).

You can try fix it use debugger (example: gdb in linux) and track error.
as kubernik says, give us a few more information at least:)
 
Thats the new problem now, still crashing. When I put on the item and then remove it, the skill rate for the magic level is elevated, and for the rest, the skills return to normal.
 
dont use scripts in onEquip or onDeEquip, it crash server in tfs 0.3.6, 0.4 and etc...
Thats the new problem now, still crashing. When I put on the item and then remove it, the skill rate for the magic level is elevated, and for the rest, the skills return to normal.
 
Code:
--Credits to MadMook and Limos for the return trues(what would i do without limos xD)--
-- Remove the "--" if you want premium or level restriction

--if you add an if then add an end!

function onEquip(cid, item, slot)
--    if isPremium(cid) then
--    if getPlayerLevel(cid) >= 8 then
    doPlayerSetSkills(cid, 2.5)
--    end
--    end
        return true
end
function onDeEquip(cid, item, slot)
--    if isPremium(cid) then
        doPlayerSetSkills(cid, 2.0)
--    else
--        doPlayerSetSkills(cid, 1.0)
--    end
return true
end
Code:
    <movevent type="Equip" itemid="2171" slot="necklace" function="onEquipItem" script="special item.lua"/>
       <movevent type="DeEquip" itemid="2171" slot="necklace" function="onDeEquipItem" script="special item.lua"/>
@M0ustafa
 
I have searched in TFS 0.3.6 luascript.cpp and it seems like it doesn't have this function doPlayerSetSkills or any similar one, Not sure why it doesn't give an error in console and crashes server immediately instead.
 
@roriscrave thats not simply... i dont know which items in normal tibia give skills. All this items give u stats and u can change it in items.xml.
Maybe the SkillRate attribute exists?
@M0ustafa well this script works when i used this item my skill rate are boosted, but it does not return to normal rate for magic level

@M0ustafa do you have an idea what function changes the rate for one of your skills?
 
@roriscrave thats not simply... i dont know which items in normal tibia give skills. All this items give u stats and u can change it in items.xml.
Maybe the SkillRate attribute exists?
@M0ustafa well this script works when i used this item my skill rate are boosted, but it does not return to normal rate for magic level

@M0ustafa do you have an idea what function changes the rate for one of your skills?
if u use a script in movements.xml will crash, any kind of script.
only test it:
Lua:
function onEquip(cid, item, slot)
        doPlayerSendTextMessage(cid,22,"Equiped")
        return true
end
function onDeEquip(cid, item, slot)
        doPlayerSendTextMessage(cid,22,"UnEquiped")
        return true
end
put an item with this simple code, then create the item with / i
(leave the body part free, the item cannot fall into a bag, it has to be created in the body, as if coming from shopOnline)
now drop the item on the floor, your server crashed

OBS: any scripts in movements.xml will crash your server, I recommend not using any
 
I changed my script to this:
Code:
function onEquip(cid, item, slot)

        doPlayerSetSkillRate(cid, 3, 2.5)
    
        return true
end
function onDeEquip(cid, item, slot)

        doPlayerSetSkillRate(cid, 3, 2.0)

return true
end
another function works better. But still crashing... so i just put my item to backpack, so now if someone got it from quest, he get bp and item inside. :) thanks for help guys
 
Back
Top