Ir para conteúdo
  • 0

[TFS-0.3.6-8.60] RESET SYSTEM COM 2 STORAGE SÓ PODE RESET SE TIVER VIP E INFINITE VIP


Muvuka

Pergunta

function onSay(cid, words, param)
 
--[Configurações de Condição]__
 
config = { --[[verdadeiro / Falso]]
 
needPa = false, -- Precisa de Premium Account? [true / false]
needPz = false, -- Precisa estar em Protection Zone? [true / false]
battle = false, -- Precisa estar sem Batlle para Resetar? [true / false]
withe = false, -- Players PK Withe pode Resetar? [true / false]
red = false, -- Players PK Red pode Resetar? [true / false]
tp = false, -- Teleportar para o Templo após o reset? [true / false]
look = true, -- Mostrar Resets no Look do Player? [true / false]
addLimite = true, -- Abilitar Limite de Resets? [true / false]
setClasse = false, -- Mudar Vocação do player quando resetar? [true / false]
storage = 54676, -- Storage [valor]
 
 
--[Configurações do Reset]__
 
resetStatus = {
 
player = getPlayerGUID(cid), -- Não Mude.
lvl = 717217, -- Level Necessário para Resetar. [valor]
lvlreset = 1, -- Level que retornará após o Reset. [valor]
limite = 100, -- Máximo de resets que um player pode chegar. [valor]
newClasse = 0, -- Id da Nova Vocação após o Reset. [valor]
tempo = 0
},
}
 
--[Funções]__
 
function Reseting(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end

function noAll(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
return TRUE
end
 
function noTeleporting(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
return TRUE
end
 
function noLook(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
return TRUE
end
 
function noClasse(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end
 
function setClasse(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doPlayerSetVocation(cid, config.resetStatus.newClasse)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end
 
function look(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = ' [Reset "..resets.."]' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end
 
function teleporting(cid)
resets = getResets(cid)
setPlayerStorageValue(cid,config.storage,resets+1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `description` = '' WHERE `players`.`id` = "..config.resetStatus.player)
db.executeQuery("UPDATE `players` SET `level` = "..config.resetStatus.lvlreset..", `experience` = 0 WHERE `id` = "..config.resetStatus.player)
return TRUE
end
 
function getResets(cid)
    local resets = getPlayerStorageValue(cid, config.storage)

    -- If the storage value is less than 0 or invalid, set resets to 0
    if type(resets) ~= "number" or resets < 0 then
        resets = 0
    end
    return resets
end

 
 
local resets = getResets(cid)
local needLvl ="Você precisa de "..config.resetStatus.lvl-getPlayerLevel(cid).." level's para resetar."
local msg ="~~[Reset: "..getResets(cid).."]~~ 'Sucesso ao Resetar! Você será deslogado em "..config.resetStatus.tempo.." Segundos."
 
 
--[Condiçoes]__

local storageKey = 13545

local storageKey = 13587

if getCreatureStorage(cid, storageKey) < os.time() then
doPlayerPopupFYI(cid, "Somente Player [VIP] Account.")
return true
 
elseif(config.needPz == true) and (getTilePzInfo(getCreaturePosition(cid)) == FALSE) then
doPlayerSendTextMessage(cid,22,"Voce Precisa estar em Protection Zone Para Resetar.")
return TRUE
 
elseif(config.addLimite == true) and (getResets(cid) == config.resetStatus.limite) then
doPlayerSendTextMessage(cid, 22, "Voce ja atingiu o Limite de Resets.")
return TRUE
 
elseif(config.withe == false) and (getCreatureSkullType(cid) == 3) then
doPlayerSendTextMessage(cid,22,"Voce ta PK White, por isso não pode resetar.")
return TRUE
 
elseif(config.red == false) and (getCreatureSkullType(cid) == 4) then
doPlayerSendTextMessage(cid,22,"Voce ta PK Red, por isso não pode resetar.")
return TRUE
 
elseif(config.needPa == true) and not isPremium(cid) then
doPlayerSendTextMessage(cid,22,"Voce Precisa ser Premium Account para Resetar.")
return TRUE
 
elseif(config.battle == true) and (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then
doPlayerSendTextMessage(cid,22,"Voce Precisa estar sem Battle para Resetar.")
return TRUE
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == true) then
addEvent(Reseting, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == false) then
addEvent(noAll, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == true) then
addEvent(noTeleporting, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == true) then
addEvent(noLook, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == true) and (config.setClasse == false) then
addEvent(noClasse, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == false) and (config.setClasse == true) then
addEvent(setClasse, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == false) and (config.look == true) and (config.setClasse == false) then
addEvent(look, config.resetStatus.tempo* 1000, cid)
 
elseif getPlayerLevel(cid) >= config.resetStatus.lvl and (config.tp == true) and (config.look == false) and (config.setClasse == false) then
addEvent(teleporting, config.resetStatus.tempo* 1000, cid)
 
elseif doPlayerSendCancel(cid, needLvl) then
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return TRUE
end

return TRUE
 
end
 
--[By: Linnux]__

 

 

COMO COLOCO CONDIÇÃO DE VIP INFINITE NO CODIGO ACIMA 

 

function onSay(cid, words, param) 
    if words == "!buyacc" then
        -- Check if the player already has permanent VIP access
        if getPlayerStorageValue(cid, 13587) == 2^31 - 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have permanent VIP access !vipacc.")
            return true
        end

        -- Check if the player already has temporary VIP
        if getPlayerStorageValue(cid, 13587) - os.time() > 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have VIP. Please wait for your time to expire.")
            return true
        end
        
        local itemid = 6527
        local count = 100
        
        if doPlayerRemoveItem(cid, itemid, count) then
            -- Set permanent VIP access
            local permanentAccess = 2^31 - 1
            setPlayerStorageValue(cid, 13587, permanentAccess)
            
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received permanent VIP access on your character.")
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need [" .. count .. " " .. getItemNameById(itemid) .. "] to get VIP.")
        end
    elseif words == "!vipacc" then
        local timenow = os.time()
        local quantity = math.floor((getPlayerStorageValue(cid, 13587) - timenow) / (24 * 60 * 60))
        if quantity > 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have permanent VIP access.")
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have permanent VIP access.")
        end
    elseif words == "/checkvip" then
        if getPlayerAccess(cid) == 5 then
            if not param then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid parameter specified.")
            else
                local player = getPlayerByName(param)
                if not isPlayer(player) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
                else
                    local timenow = os.time()
                    local quantity = math.floor((getPlayerStorageValue(player, 13587) - timenow) / (24 * 60 * 60))
                    if quantity > 0 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player " .. param .. " has " .. quantity .. " days of VIP.")
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player " .. param .. " does not have any VIP days.")
                    end
                end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have access to this command.")
        end
    elseif words == "/addvip" then
        if getPlayerAccess(cid) == 5 then
            local t = string.explode(param, ",")
            if not t[2] then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid parameter specified.")
            else
                local playerName = t[1]
                local player = getPlayerByName(playerName)
                local days = tonumber(t[2])
                
                if not player then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn't exist or is offline.")
                    return true
                end
                
                local daysvalue = days * 3600 * 24
                local storageplayer = getPlayerStorageValue(player, 13587)
                local timenow = os.time()
                local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)
                
                setPlayerStorageValue(player, 13587, time)
                local quantity = math.floor((getPlayerStorageValue(player, 13587) - timenow) / (3600 * 24))
                doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "You have " .. quantity .. " days of VIP remaining.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have access to this command.")
        end
    elseif words == "/delvip" then
        if getPlayerAccess(cid) == 5 then
            local dec = MESSAGE_INFO_DESCR
            if param == "" then
                return true, doPlayerSendTextMessage(cid, 18, "Command parameter required.")
            end
            local t = string.explode(param, ",")
            local C = {}
            C.pos = getPlayerPosition(cid)
            C.uid = getCreatureByName(t[1])
            C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2])) * 3600 * 24 -- VIP time per day.
            C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) -- VIP days.
            
            if getPlayerStorageValue(C.uid, 13587) < C.time then
                doPlayerSendTextMessage(cid, dec, 'The player ' .. t[1] .. ' does not have ' .. C.days .. ' days of VIP.')
            else
                doPlayerSendTextMessage(cid, dec, 'You have removed ' .. C.days .. ' days of VIP from player ' .. t[1] .. '.')
                setPlayerStorageValue(C.uid, 13587, getPlayerStorageValue(C.uid, 13587) - C.time)
            end
            doSendMagicEffect(C.pos, math.random(28, 30))
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have access to this command.")
        end
    end
    return true
end

 

 

 

 

function onSay(cid, words, param)
    if words == "!buyvip" then
        -- Check if the player already has permanent VIP
        if getPlayerStorageValue(cid, 13587) == 2^31 - 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You already have permanent VIP and cannot buy temporary VIP !vipacc.")
            return true
        end

        -- Check if the player has already used the command
        if getPlayerStorageValue(cid, 13587) == 1 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have already used this command and cannot use it again.")
            return true
        end

        local itemid = 2159
        local count = 50000

        if doPlayerRemoveItem(cid, itemid, count) then
            local days = 372
            local daysvalue = days * 24 * 60 * 60
            local storageplayer = getPlayerStorageValue(cid, 13545)
            local timenow = os.time()
            
            local time
            if storageplayer - timenow <= 0 then
                time = timenow + daysvalue
            else
                time = storageplayer + daysvalue
            end
            
            -- Update VIP status without modifying the name
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Added " .. days .. " days of VIP to your character.")
            setPlayerStorageValue(cid, 13545, time)
            local quantity = math.floor((getPlayerStorageValue(cid, 13545) - timenow) / (24 * 60 * 60))
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have " .. (quantity < 0 and 0 or quantity) .. " days of VIP remaining.")

            -- Mark that the player used the command
            setPlayerStorageValue(cid, 13587, 1)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need [" .. count .. " " .. getItemNameById(itemid) .. "] to add VIP.")
        end

    elseif words == "!vipdays" then
        local timenow = os.time()
        local vipEndTime = getPlayerStorageValue(cid, 13545)
        local vipDays = 0
        
        if vipEndTime > 0 then
            -- Calculate the remaining VIP days
            vipDays = math.ceil((vipEndTime - timenow) / (24 * 60 * 60))
        end
        
        if vipDays > 0 then
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have " .. vipDays .. " days of VIP on your character.")
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have VIP days.")
        end

    elseif words == "/checkvip" then
        if getPlayerAccess(cid) == 5 then
            if not param or param == "" then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid parameter.")
            else
                local player = getPlayerByName(param)
                if not isPlayer(player) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. param .. " not found.")
                else
                    local timenow = os.time()
                    local quantity = math.floor((getPlayerStorageValue(player, 13545) - timenow) / (24 * 60 * 60))
                    if quantity > 0 then
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player " .. param .. " has " .. quantity .. " days of VIP.")
                    else
                        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Player " .. param .. " does not have VIP days.")
                    end
                end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have access to this command.")
        end

    elseif words == "/addvip" then
        if getPlayerAccess(cid) == 5 then
            local t = string.explode(param, ",")
            if not t[2] then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid parameter.")
            else
                local playerName = t[1]
                local player = getPlayerByName(playerName)
                if not isPlayer(player) then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. playerName .. " not found.")
                else
                    local days = tonumber(t[2])
                    local daysvalue = days * 24 * 60 * 60
                    local storageplayer = getPlayerStorageValue(player, 13545)
                    local timenow = os.time()
                    local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)
                    
                    -- Update VIP status without modifying the name
                    doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Added " .. days .. " days of VIP to your character.")
                    setPlayerStorageValue(player, 13545, time)
                    local quantity = math.floor((getPlayerStorageValue(player, 13545) - timenow) / (24 * 60 * 60))
                    doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "You have " .. quantity .. " days of VIP remaining.")
                end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have access to this command.")
        end

    elseif words == "/delvip" then
        if getPlayerAccess(cid) == 5 then
            local dec = MESSAGE_INFO_DESCR
            if param == "" then
                return TRUE, doPlayerSendTextMessage(cid, 18, "Command parameter is required.")
            end
            local t = string.explode(param, ",")
            local player = getPlayerByName(t[1])
            if not isPlayer(player) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
            else
                local days = tonumber(t[2])
                local timeToRemove = days * 24 * 60 * 60
                local currentTime = getPlayerStorageValue(player, 13545)
                
                if currentTime < timeToRemove then
                    doPlayerSendTextMessage(cid, dec, "Player " .. t[1] .. " does not have " .. days .. " days of VIP.")
                else
                    doPlayerSendTextMessage(cid, dec, "Removed " .. days .. " days of VIP from player " .. t[1] .. ".")
                    setPlayerStorageValue(player, 13545, currentTime - timeToRemove)
                end
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have access to this command.")
        end
    end
    return true
end

 

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...