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

[CreatureScript]Rook System

Legnak Bqm

New Member
Joined
Mar 25, 2010
Messages
120
Reaction score
1
Location
Venezuela
Hi, i need a script that make something like this: if the player is downgraded to level 29 his/her town is changed to 22 and starts in level 20 with all skills 10 ,ml 0.

It`s relatively easy but i can´t make it xD, i was trying but i failed T_T

I would appreciate any help :>
 
Last edited:
OMG Fail xd... sorry the player starts in level 20, but i want my rook system for the players if they are downgraded to level 29 then become level 20 with skills 10 and ml 0 and his/her town is changed to 22 (rookgard).
 
If you want(or if it doesnt work) change to onLogin(remember to chnage i xml)
Lua:
function onLogout(cid)
if getPlayerLevel(cid) <= 29 then
doPlayerSetTown(cid, 22)
doPlayerAddExperience(cid, -getPlayerExperience(cid))
doPlayerAddExperience(cid, getExperienceForLevel(20))
for i = 0, 6 do
doPlayerAddSkillTry(cid, i, -getPlayerSkillTries(cid, i))
doPlayerAddMagLevel(cid, -getPlayerMagLevel(cid))
end
end
return TRUE
end
skills may don't remove, say I will correct it
 
i thought the one i did would help <.< well it doesnt work 100% as you told me
well you say it works 50%, i misunderstood your request but I know how to do it to make it work, just notify me when you get back online

Lua:
  --STORAGE, VARIABLE
local s, town = 2040, 22
 
local isAtRange = function(from, to, value)
    return from <= value and value <= to
end
 
function onPrepareDeath(cid, deathList)
    if isPlayer(cid) and isAtRange(30,35,getPlayerLevel(cid)) or isAtRange(11,15,getPlayerLevel(cid)) then
        doCreatureSetStorage(cid, s, getPlayerLevel(cid))
    end
return true
end
 
function onLogin(cid)
    registerCreatureEvent(cid, 'overReset')
    if isAtRange(30,35, getCreatureStorage(cid, s)) and getPlayerLevel(cid) == 29 then
        doPlayerSetTown(cid, town)
        doCreatureSetStorage(cid, s, 0)
        doCreatureSetStorage(cid, 50000, -1)
        doTeleportThing(cid, getTownTemplePosition(town))
    elseif isAtRange(11,15, getCreatureStorage(cid, s)) and getPlayerLevel(cid) == 10 then
        doCreatureSetStorage(cid, s, 0)
        doCreatureSetStorage(cid, 50000, -1)
        local guid = getPlayerGUID(cid)
        doRemoveCreature(cid)
        db.executeQuery("UPDATE `players` SET `maglevel` = 0, `manaspent` = 0 WHERE `id` = " .. guid ..";")
        for i = 0, 6 do
            db.executeQuery("UPDATE `player_skills` SET `value` = 10, `count` = 0 WHERE `skillid` = ".. i .." AND `player_id` = ".. guid ..";")
        end    
    end
return true
end
 
Last edited:
Back
Top