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

Scripter pay for who make it work on tfs 0.4 mysql

darknelson

Member
Joined
Jun 19, 2011
Messages
190
Solutions
1
Reaction score
15


i pay on tibia coins, need it work for tfs 0.4 and also give a reward for each rebirth and have storage to make special zones.
 


i pay on tibia coins, need it work for tfs 0.4 and also give a reward for each rebirth and have storage to make special zones.
its already in 0.4
 
well its for tfs 0.4 just add this in your lib folder in 100-compat
Lua:
db.executeQuery = db.query
and about prize every rebirth you can use this script to give him money as a reward your npc :-
Code:
local config = {
    price = 0, -- Price of first rebirth
    priceIncrease = 0, -- Works as 'price' + current rebirths * priceIncrease.
    rebirthLevel = 717171, -- Level for first rebirth.
    rebirthIncrease = 0, -- Works as 'rebirthLevel' + current rebirths * rebirthIncrease.
    maxRebirths = 1000, -- Number of times a player can rebirth.
    level = 8, -- The level the player is set to apon rebirth.
    healthPercent = 1.00, -- 1.00 = 100%.
    health = 100, -- Only used if 'healthPercent' = 0.
    manaPercent = 1.00, -- 1.00 = 100%.
    mana = 100, -- Only used if 'manaPercent' = 0.
    keepSkills = true, -- Wether players keep skills and level apon rebirth.
    money = 5000, -- how much will he get for every reb he do 'this number multiply by his rebirth' so if he is reb 1 he will get 5k if he is reb 2 he will take 10k,etc
    skillLevel = 10, -- Only used if 'keepSkills' = false.
    magicLevel = 0, -- Only used if 'keepSkills' = false.
    capacity = 10000, -- The capacity players are set to apon rebirth.
    templePos = {x = 0, y = 0, z = 0}, -- The place where players reset to should there town id return 0.
    Rebirth = 1 -- how many Rebirth player will get.
}
 
local focuses = {}
local function isFocused(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            return true
        end
    end
    return false
end
 
local function addFocus(cid)
    if(not isFocused(cid)) then
        table.insert(focuses, cid)
    end
end
local function removeFocus(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            table.remove(focuses, i)
            break
        end
    end
end
local function lookAtFocus()
    for i, v in pairs(focuses) do
        if(isPlayer(v)) then
            doNpcSetCreatureFocus(v)
            return
        end
    end
    doNpcSetCreatureFocus(0)
end
 
function onCreatureDisappear(cid)
    if(isFocused(cid)) then
        selfSay("Goodbye.")
        removeFocus(cid)
    end
end

  
function onCreatureSay(cid, type, msg)
    if((msg == "hi") and not (isFocused(cid))) then
        selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)
        selfSay("Im in charge of the {Rebirth} system.", cid)
        addFocus(cid)
        status = 1
    elseif((isFocused(cid)) and (msg == "rebirth")  or (msg == "Rebirth") or (msg == "reb")  and (status == 1)) then
              if(isInArray({1,2,3,4,5, 6, 7, 8,9,10,11,12}, getPlayerVocation(cid))) then
        if (getPlayerRebirth(cid, config.Rebirth) < config.maxRebirths) then
            Rebirth = getPlayerRebirth(cid, config.Rebirth)
            rebirthLevel = config.rebirthLevel + (config.rebirthIncrease * Rebirth)
            if (getPlayerLevel(cid) >= rebirthLevel) then
                money = config.price + (config.priceIncrease * Rebirth)
                if (getPlayerMoney(cid) >= money) then
                    selfSay("Once you rebirth you will have to level up again from the beginning! Are you sure you still want to rebirth?", cid)
                    status = 2
                else
                    selfSay("You need at least " .. money .. " gold before you can rebirth.", cid)
                    status = 1
                end
                else
                    selfSay("You need to be at least level " .. rebirthLevel .. " before you can rebirth.", cid)
                status = 1
                end
            else
            selfSay("It seems you can not rebirth anymore you are max rebirth .", cid)
            status = 1
            end
        else
            selfSay("Please talk with Zarzor King and promote first.", cid)
             status = 1
        end
    elseif((isFocused(cid)) and (msg == "yes") and (status == 2)) then
        selfSay("Ok then i will rebirth you.", cid)
        selfSay("You will now be logged out.", cid)
        doPlayerRemoveMoney(cid, money)
        addEvent(doRebirthPlayer, 0, {cid=cid})
        removeFocus(cid)
    elseif((isFocused(cid)) and (msg == "no") and (status == 2)) then
        selfSay("Maybe one day you will wise up and change your mind!", cid)
        status = 1
    elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
        selfSay("Goodbye!", cid, true)
        removeFocus(cid)
    end
end
 
function onPlayerCloseChannel(cid)
    if(isFocused(cid)) then
        selfSay("Goodbye.")
        removeFocus(cid)
    end
end
 
function onThink()
    for i, focus in pairs(focuses) do
        if(not isCreature(focus)) then
            removeFocus(focus)
        else
            local distance = getDistanceTo(focus) or -1
            if((distance > 4) or (distance == -1)) then
                selfSay("Goodbye.")
                removeFocus(focus)
            end
        end
    end
    lookAtFocus()
end
 
function doRebirthPlayer(cid)
    cid = cid.cid
    if (cid == nil) then
        return true
    end
 
    local guid = getPlayerGUID(cid)
 
    if (config.healthPercent > 0) then
        health = getCreatureMaxHealth(cid) * config.healthPercent
    else
        health = config.health
    end
    if (config.manaPercent > 0) then
        mana = getCreatureMaxMana(cid) * config.manaPercent
    else
        mana = config.mana
    end
    if (getPlayerTown(cid) > 0) then
        pos = getTownTemplePosition(getPlayerTown(cid))
    else
        pos = config.templePos
end
 
    doAddRebirth(cid, config.Rebirth, getPlayerRebirth(cid, config.Rebirth) + 1)
    doPlayerAddMoney(cid, (getPlayerRebirth(cid, config.Rebirth)) * config.money)
    doRemoveCreature(cid, true)
    db.executeQuery("UPDATE `players` SET level = " .. config.level .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET health = " .. health .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET healthmax = " .. health .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET mana = " .. mana .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET manamax = " .. mana .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET posx = " .. pos.x .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET posy = " .. pos.y .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET posz = " .. pos.z .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET cap = " .. config.capacity .. " WHERE id = " .. guid .. ";")

    if (not config.keepSkills) then
        db.executeQuery("UPDATE `players` SET maglevel = " .. config.magicLevel .. " WHERE id = " .. guid .. ";")
        db.executeQuery("UPDATE `player_skills` SET value = " .. config.skillLevel .. " WHERE id = " .. guid .. ";")
    end
    return true
end
hope i helped :)
 
well its for tfs 0.4 just add this in your lib folder in 100-compat
Lua:
db.executeQuery = db.query
and about prize every rebirth you can use this script to give him money as a reward your npc :-
Code:
local config = {
    price = 0, -- Price of first rebirth
    priceIncrease = 0, -- Works as 'price' + current rebirths * priceIncrease.
    rebirthLevel = 717171, -- Level for first rebirth.
    rebirthIncrease = 0, -- Works as 'rebirthLevel' + current rebirths * rebirthIncrease.
    maxRebirths = 1000, -- Number of times a player can rebirth.
    level = 8, -- The level the player is set to apon rebirth.
    healthPercent = 1.00, -- 1.00 = 100%.
    health = 100, -- Only used if 'healthPercent' = 0.
    manaPercent = 1.00, -- 1.00 = 100%.
    mana = 100, -- Only used if 'manaPercent' = 0.
    keepSkills = true, -- Wether players keep skills and level apon rebirth.
    money = 5000, -- how much will he get for every reb he do 'this number multiply by his rebirth' so if he is reb 1 he will get 5k if he is reb 2 he will take 10k,etc
    skillLevel = 10, -- Only used if 'keepSkills' = false.
    magicLevel = 0, -- Only used if 'keepSkills' = false.
    capacity = 10000, -- The capacity players are set to apon rebirth.
    templePos = {x = 0, y = 0, z = 0}, -- The place where players reset to should there town id return 0.
    Rebirth = 1 -- how many Rebirth player will get.
}

local focuses = {}
local function isFocused(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            return true
        end
    end
    return false
end

local function addFocus(cid)
    if(not isFocused(cid)) then
        table.insert(focuses, cid)
    end
end
local function removeFocus(cid)
    for i, v in pairs(focuses) do
        if(v == cid) then
            table.remove(focuses, i)
            break
        end
    end
end
local function lookAtFocus()
    for i, v in pairs(focuses) do
        if(isPlayer(v)) then
            doNpcSetCreatureFocus(v)
            return
        end
    end
    doNpcSetCreatureFocus(0)
end

function onCreatureDisappear(cid)
    if(isFocused(cid)) then
        selfSay("Goodbye.")
        removeFocus(cid)
    end
end

 
function onCreatureSay(cid, type, msg)
    if((msg == "hi") and not (isFocused(cid))) then
        selfSay("Welcome, ".. getCreatureName(cid) ..".", cid, true)
        selfSay("Im in charge of the {Rebirth} system.", cid)
        addFocus(cid)
        status = 1
    elseif((isFocused(cid)) and (msg == "rebirth")  or (msg == "Rebirth") or (msg == "reb")  and (status == 1)) then
              if(isInArray({1,2,3,4,5, 6, 7, 8,9,10,11,12}, getPlayerVocation(cid))) then
        if (getPlayerRebirth(cid, config.Rebirth) < config.maxRebirths) then
            Rebirth = getPlayerRebirth(cid, config.Rebirth)
            rebirthLevel = config.rebirthLevel + (config.rebirthIncrease * Rebirth)
            if (getPlayerLevel(cid) >= rebirthLevel) then
                money = config.price + (config.priceIncrease * Rebirth)
                if (getPlayerMoney(cid) >= money) then
                    selfSay("Once you rebirth you will have to level up again from the beginning! Are you sure you still want to rebirth?", cid)
                    status = 2
                else
                    selfSay("You need at least " .. money .. " gold before you can rebirth.", cid)
                    status = 1
                end
                else
                    selfSay("You need to be at least level " .. rebirthLevel .. " before you can rebirth.", cid)
                status = 1
                end
            else
            selfSay("It seems you can not rebirth anymore you are max rebirth .", cid)
            status = 1
            end
        else
            selfSay("Please talk with Zarzor King and promote first.", cid)
             status = 1
        end
    elseif((isFocused(cid)) and (msg == "yes") and (status == 2)) then
        selfSay("Ok then i will rebirth you.", cid)
        selfSay("You will now be logged out.", cid)
        doPlayerRemoveMoney(cid, money)
        addEvent(doRebirthPlayer, 0, {cid=cid})
        removeFocus(cid)
    elseif((isFocused(cid)) and (msg == "no") and (status == 2)) then
        selfSay("Maybe one day you will wise up and change your mind!", cid)
        status = 1
    elseif((isFocused(cid)) and (msg == "bye" or msg == "goodbye" or msg == "cya")) then
        selfSay("Goodbye!", cid, true)
        removeFocus(cid)
    end
end

function onPlayerCloseChannel(cid)
    if(isFocused(cid)) then
        selfSay("Goodbye.")
        removeFocus(cid)
    end
end

function onThink()
    for i, focus in pairs(focuses) do
        if(not isCreature(focus)) then
            removeFocus(focus)
        else
            local distance = getDistanceTo(focus) or -1
            if((distance > 4) or (distance == -1)) then
                selfSay("Goodbye.")
                removeFocus(focus)
            end
        end
    end
    lookAtFocus()
end

function doRebirthPlayer(cid)
    cid = cid.cid
    if (cid == nil) then
        return true
    end

    local guid = getPlayerGUID(cid)

    if (config.healthPercent > 0) then
        health = getCreatureMaxHealth(cid) * config.healthPercent
    else
        health = config.health
    end
    if (config.manaPercent > 0) then
        mana = getCreatureMaxMana(cid) * config.manaPercent
    else
        mana = config.mana
    end
    if (getPlayerTown(cid) > 0) then
        pos = getTownTemplePosition(getPlayerTown(cid))
    else
        pos = config.templePos
end

    doAddRebirth(cid, config.Rebirth, getPlayerRebirth(cid, config.Rebirth) + 1)
    doPlayerAddMoney(cid, (getPlayerRebirth(cid, config.Rebirth)) * config.money)
    doRemoveCreature(cid, true)
    db.executeQuery("UPDATE `players` SET level = " .. config.level .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET health = " .. health .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET healthmax = " .. health .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET mana = " .. mana .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET manamax = " .. mana .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET posx = " .. pos.x .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET posy = " .. pos.y .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET posz = " .. pos.z .. " WHERE id = " .. guid .. ";")
    db.executeQuery("UPDATE `players` SET cap = " .. config.capacity .. " WHERE id = " .. guid .. ";")

    if (not config.keepSkills) then
        db.executeQuery("UPDATE `players` SET maglevel = " .. config.magicLevel .. " WHERE id = " .. guid .. ";")
        db.executeQuery("UPDATE `player_skills` SET value = " .. config.skillLevel .. " WHERE id = " .. guid .. ";")
    end
    return true
end
hope i helped :)
He is using this distro, that would work only on TFS 1.x+
- Fir3element/3777 (https://github.com/Fir3element/3777/tree/2a3447b6be9930c45340e9df726a66d686a225a3)
 
Back
Top