• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved [Avesta 7.4] (War) Level reset to 50 if lvl below 50

Demnish

Tibian Hero
Joined
Sep 28, 2011
Messages
401
Solutions
2
Reaction score
63
Location
Sweden
I need a script that makes the killed characters go back to lvl 50 after theyve died.


This is what I have, they do not work:
creaturescripts.xml
Code:
<?xml version="1.0"?>

<creaturescripts>
<event type="login" name="login" event="script" value="login.lua"/>
<event type="login" name="lvl" event="script" value="lvl.lua"/>
</creaturescripts>
Code:
function onLogin(cid)
    if getPlayerLevel(cid) < 50 then
        doPlayerAddExp(cid, (getExpForLevel(50) - getPlayerExp(cid)))
    end
    return TRUE
end
login.lua
Code:
function onLogin(cid)
registerCreatureEvent(cid, "lvl")
    return 1
end


Help would me MUCH appreciated.
Thanks in advance.


SOLVED by Ond.
Code:
function onLogin(cid)
    if getPlayerExperience(cid) < 1847300 then
       doPlayerAddExp(cid, (-getPlayerExperience(cid)) + 1847300)
    end
    return 1
end
 
Last edited:
Add this somewhere in login.lua

Code:
if getPlayerExperience(cid) < 1847300 then
    doPlayerAddExp(cid, (-getPlayerExperience(cid)) + 1847300))
end
 
I tried putting it like this:

login.lua
Code:
function onLogin(cid)
if getPlayerExperience(cid) < 1847300 then
    doPlayerAddExp(cid, (-getPlayerExperience(cid)) + 1847300))
registerCreatureEvent(cid, "lvl")
    return 1
end

But it didnt work, I logged in on a lvl 40 to see if he gained level.
Did I put it in correctly?
 
Code:
function onLogin(cid)
   registerCreatureEvent(cid, "lvl")
   if getPlayerExperience(cid) < 1847300 then
       doPlayerAddExp(cid, (-getPlayerExperience(cid)) + 1847300))
   end
  return 1
end
 
Removed a brackett. Also there is no need to register the event since it's a "login-script".

Code:
function onLogin(cid)
    if getPlayerExperience(cid) < 1847300 then
       doPlayerAddExp(cid, (-getPlayerExperience(cid)) + 1847300)
    end
    return 1
end
 
Back
Top