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

How do I add db.executequery to OTServ 8.60 r6052?

wiirgy

New Member
Joined
Mar 29, 2008
Messages
9
Reaction score
0
Hey how would I add the db.executequery function to OTServ 8.60 r6052? I need this because of the script below.


Code:
function onSay(cid, words, param)
    config = {
        RemainingLvl = 8, -- That level will be reborn after.
        exp = 4200, -- Experience that will be reborn after.
        pid = getPlayerGUID(cid), 
        skull = true, -- Players with white skull can reborn? (true or false).
        redskull = true, -- Players with red skull can reborn? (true or false).
        prot = true, -- Players need to be in protection zone to reborn? (true or false).
        bat = true, -- Players must be no fight to reborn (true or false).
        vip = true -- Vip system (true or false).
    }
 
    stage = {
        {level = 360, reborn = 4},
        {level = 380, reborn = 9},
        {level = 400, reborn = 14}
    }
 
    if(config.skull == false) and (getCreatureSkullType(cid) == 3) then
        doPlayerSendTextMessage(cid, 22, "Only players without white skull can reborn.")
        return true
    end
 
    if(config.redskull == false) and (getCreatureSkullType(cid) == 4) then
        doPlayerSendTextMessage(cid, 22, "Only player without red skull can reborn.")
        return true
    end
 
    if(config.prot == true) and (getTilePzInfo(getCreaturePosition(cid)) == false) then
        doPlayerSendTextMessage(cid, 22, "You need stay in PZ to reborn.")
        return true
    end
 
    if(config.bat == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == true) then
        doPlayerSendTextMessage(cid, 22, "Players without battle can reborn.")
        return true
    end
 
    for _, k in ipairs(stage) do
        if getReborns(cid) <= k.reborn then
            if getPlayerLevel(cid) >= k.level then
               setPlayerStorageValue(cid, 1020, getReborns(cid)+1)
			   doPlayerSendTextMessage(cid, 22, "You now was reborn, you have "..getReborns(cid)+(1).." reborn\'s.")
               doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
               doRemoveCreature(cid)
               db.executeQuery("UPDATE `players` SET `level` = "..config.RemainingLvl..", `experience` = "..config.exp.." WHERE `id` = "..config.pid)
            else
               doPlayerSendCancel(cid, "You need to have level "..k.level.." or more you may be reborn.")
               doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
            end
        end
    end
    return true
end
 
Back
Top