Ir para conteúdo

Featured Replies

Postado

Pequeno update para quem ainda se interessar tinha alguns erros ainda no original, sem perguntas por favor, ta ai o script:

 

--[[

ALTER TABLE `accounts` ADD `vip_time` BIGINT(20) NOT NULL DEFAULT 0;

--]]

-- player:getVipTime()
function Player.getVipTime(self)
	local resultId = db.storeQuery("SELECT `vip_time` FROM `accounts` WHERE `id` = '".. self:getAccountId() .."';")
	local time = resultId ~= false and result.getDataInt(resultId, "vip_time") or 0
	result.free(resultId)
	return time
end

-- player:isVip()
function Player.isVip(self)
	return self:getVipTime() > os.time() and true or false
end

-- player:addVipDays(days)
function Player.addVipDays(self, days)
	return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() + (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;")
end

-- player:removeVipDays(days)
function Player.removeVipDays(self, days)
	return(self:isVip() and tonumber((days * 86400))) and db.query("UPDATE `accounts` SET `vip_time` = '".. (self:getVipTime() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;") or db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;")
end

-- player:setVipDays(days)
function Player.setVipDays(self, days)
	return db.query("UPDATE `accounts` SET `vip_time` = '".. (os.time() - (days * 86400)) .."' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;")
end

-- player:removeVip()
function Player.removeVip(self)
	db.query("UPDATE `accounts` SET `vip_time` = '0' WHERE `id` ='".. self:getAccountId() .."' LIMIT 1 ;")
end

-- player:doVipDays()
function Player.sendVipDaysMessage(self)
	local vipDays = math.floor(self:getVipTime() / 86400)
	return self:getVipTime() ~= false and self:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, 'Your have '.. vipDays .. ' vip days.')
end

 

                              _
                          .-'` `}
                  _./)   /       }
                .'o   \ |       }
                '.___.'`.\    {`
                /`\_/  , `.    }                                      ME DA UMA NOZ!
                \=' .-'   _`\  {
                 `'`;/      `,  }
                    _\   @   ;  }
                   /__`;-...'--'

Cluck!

  • Respostas 77
  • Visualizações 11.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • luanluciano93
    luanluciano93

    @andreoam, poste o que você tem em spoiler. 

  • @gangul321 Para colocar em spoiler siga esses passos.

  • luanluciano93
    luanluciano93

    tileVip.lua  function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if player == nil then return false end return player:isVip() and true or false e

Posted Images

  • 2 weeks later...
Postado

@Liane Maria, evite mensagens não relacionadas ao tópico, isso é considerado flood! Você pode fazer seu pedido na seção de pedidos do TibiaKing:

http://www.tibiaking.com/forum/forums/forum/361-pedido/

 

Regras Gerais: http://www.tibiaking.com/forum/forums/topic/1281-regras-gerais/

 

  • 1 month later...
Postado

Ainda não sei porque este tópico não estava fixado... Muito útil isso! :)

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