Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado
  • Autor

Testa esse:

-- Script Editado por TsplayerT --

function onSay(cid, words, param)
if(words == "!buyvip") then
local price = 2000000
if doPlayerRemoveMoney(cid, 2000000) == TRUE then

local days = 30
local storageplayer = (getPlayerAccountId(cid)+550)
if getGlobalStorageValue(storageplayer ) <= 0 then
setGlobalStorageValue(storageplayer , 1)
addVipDays(cid, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu um "..days.." dias de vip, bom jogo!")

local daysvalue = days * 24 * 60 * 60
local timenow = os.time()

if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Foram adicionados ".. days .." dias de VIP no seu character.")
setPlayerStorageValue(cid, 13540, time)

local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. quantity .." dias de VIP restantes.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você precisa de "..price.." gp's para colocar vip.")
end

elseif(words == "!vipdays") then
local timenow = os.time()
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no seu character.")

elseif(words == "/checkvip") then
if getPlayerAccess(cid) == 5 then
if not param then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end

local player = getPlayerByName(param)
local pid = getPlayerByNameWildcard(param)
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
return TRUE
end

local timenow = os.time()

local quantity = math.floor((getPlayerStorageValue(player, 13540) - timenow)/(24 * 60 * 60))
doPlayerPopupFYI(cid, "O jogador tem ".. (quantity < 0 and 0 or quantity) .." dias de VIP no character.")
return TRUE
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 param specified.")
end

local player = getPlayerByName(t[1])
local days = t[2]
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) 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, 13540)
local timenow = os.time()

local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)

doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram adicionados "..days.." dias de VIP no seu character.")
setPlayerStorageValue(player, 13540, time)
local quantity = math.floor((getPlayerStorageValue(player,13540) - timenow)/(3600*24))
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você tem "..quantity.." dias de VIP restantes.")
end

elseif(words == "/delvip") then
if getPlayerAccess(cid) == 5 then
local dec = MESSAGE_INFO_DESCR
if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
local C,t = {},string.explode(param, ",")
C.pos = getPlayerPosition(cid)
C.uid = getCreatureByName(t[1])
C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2]))*3600*24 --Tempo da vip por dia.
C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) --Dias de vip.
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
return TRUE
end

if(getPlayerStorageValue(C.uid,13540) < C.time)then
doPlayerSendTextMessage(cid,dec,'O jogador '..t[1]..' não possui '..C.days..' dias de vip.')
else
doPlayerSendTextMessage(cid,dec,'Você removeu '..C.days..' dias de vip do player '..t[1]..'.')
setPlayerStorageValue(C.uid,13540,getPlayerStorageValue(C.uid,13540)-C.time)
end
doSendMagicEffect(C.pos, math.random(28,30))
end
end

return TRUE
end

também nada

OuhEeY.png

  • Respostas 12
  • Visualizações 341
  • Created
  • Última resposta

Top Posters In This Topic

Postado

também nada

 

Vip System:

Em data/lib/core/core.lua adicione a seguinte linha:

dofile('data/lib/core/vipsystem.lua')
Ainda em data/lib/core crie um arquivo chamado vipsystem com o seguinte conteúdo:

function Player.getVip(self)
    if not self:isPlayer() then error('Player don\'t find') end
    local query = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '" .. self:getAccountId() .. "';")
    if not query then
        return 0
    end

    local days = result.getDataInt(query, "vip_time") or 0
    result.free(query)
    return days
end

function Player.setVip(self, time)
    dofile("config.lua")
    assert(tonumber(time), 'Parameter must be a number')
    if not self:isPlayer() then error('Player don\'t find') end
    db.query("UPDATE `accounts` SET `vip_time` = '" .. ( os.time() + time ) .. "' WHERE `accounts`.`id` ='" .. self:getAccountId() .. "';")
end

function Player.isVip(self)
    if not self:isPlayer() then return end
    local t = self:getVip() or 0
    if os.time(day) < t then
        return true
    else
        return false
    end
end

function getDays(days)
    return (3600 * 24 * days)
end

function Player.addVipByAccount(self, time)
    assert(tonumber(time), 'Parameter must be a number')
    local a = self:getVip()
    a = os.difftime(a, os.time())
    if a < 0 then a = 0 end
    a = a + time
    return self:setVipByAccount(a)
end

function Player.setVipByAccount(self, time)
    assert(tonumber(time), 'Parameter must be a number')
    dofile("config.lua")
    db.query("UPDATE `accounts` SET `vip_time` = '" ..(os.time() + time) .. "' WHERE `accounts`.`id` ='" .. self:getAccountId() .. "';")
    return true
end

function Player.returnVipString(self)
    if self:isPlayer() then
        return os.date("%d %B %Y %X ", self:getVip())
    end
end

Talkaction para Add Vip:

Em data/talkactions/talkactions.xml adicione a seguinte tag:
<talkaction words="/vip" separator=" " script="addvip.lua" />Agora em data/talkactions/scripts crie um arquivo chamado addvip.lua com o seguinte conteúdo:
function onSay(player, words, param)
    if param == "" then
        doPlayerPopupFYI(player, "Esta com problemas?\n---------------\nAdicionar vip:\n/vip add days player\n/vip add 30 Diabolic=\n---------------\n")
        return false
    end
    if param:lower():find('add') == 1 and 3 then
        local _, _, id, name = param:lower():find('add (%d+) (.+)')
        name = name or ""
        local p = Player(name)
        id = tonumber(id or 1) or 1
        if id == nil then
            doPlayerPopupFYI(player, "Adicionar vip:\n/vip add days player\n---------------\nExemplo:\n/vip add 30 Diabolic")
            return false
        elseif not p then
            player:sendCancelMessage("O jogador " .. name .. " nao existe ou nao esta online.") return false
        end
        
        if p:isPlayer()then
            p:addVipByAccount(getDays(id))
            player:sendTextMessage(MESSAGE_EVENT_ORANGE, "Foram adicionados " .. id .. " dias de vip a jogador " .. name .. ".")
            p:sendTextMessage(MESSAGE_EVENT_ORANGE, "Voce recebeu " .. id .. " dias de vip.")
        else
            player:sendCancelMessage(name .. " nao esta online ou nao existe.") return false
        end
    end
    return false
end

É só usar o comando, por exemplo: /vip add 30 Bruno

Créditos:

Bruno Minervino

Mock

 

 

@EDIT:

Caso não funcione teste esses aqui, que é certeza que funciona:

http://www.tibiaking.com/forum/topic/37356-account-vip-system-por-killua/

http://www.tibiaking.com/forum/topic/34334-vip-system-by-account-10-by-kydrai/

Editado por TsplayerT (veja o histórico de edições)

Meus Contatos!

 

Minhas Funções:

 

               Skype: TsplayerT

         Facebook: TakaFukushii

          YouTube: ADoseDupla

           Twitter: @_Splayer_

 

 

 

 

 

 

 

                             Mapper:▓▓▓▓▓▓▓▓▓▓ 97%

     Programmer:▓▓▓▓▓▒▒▒▒▒ 45%

             Scripter:▓▓▓▓▓▓▓▓▓▒ 83%

              Spriter:▓▓▓▓▓▓▒▒▒▒ 57%

    Gamemaster:▓▓▓▓▓▓▓▓▓▓ 99%

        Ot Creator:▓▓▓▓▓▓▓▒▒▒71%

Ot Client Maker:▓▓▓▓▓▓▓▒▒▒74%

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo