Bom pessoal, andei procurando muito por este script, mas nao achei um que se adapte ao meu Sistema VIP.
Eu tentei utilizar esse Script:
function onStepIn(cid, item, position, fromPosition)
local config = {
msgDenied = "Você precisa ser vip.",
msgWelcome = "Bem-Vindo a Area Vip!."
}
if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
doTeleportThing(cid, fromPosition, true)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgDenied)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return TRUE
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, config.msgWelcome)
return TRUE
end
E também este:
function onUse(cid, item)
local days = 10 -- dias que vai ganhar usando o item
vip.addVipByAccount(getPlayerAccount(cid), days)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Foram adicionados "..days.." dias de vip a "..getCreatureName(cid)..".")
return true
end
---
Mas nenhum funcionou. Já verifiquei o Storage dos players vip's nos scripts, mas mesmo assim, nada.
Alguem pode me ajudar?
---
Lib:
--[[
Name: Vip System by Account
Version: 1.0
Author: Kydrai
Forum: http://www.xtibia.com/forum/topic/136543-vip-system-by-account-v10/
[Functions]
-- Install
installVip()
-- By Account
doTeleportPlayersByAccount(acc, topos)
getVipTimeByAccount(acc)
setVipTimeByAccount(acc, time)
getVipDaysByAccount(acc)
isVipAccount(acc)
addVipDaysByAccount(acc, days)
doRemoveVipDaysByAccount(acc, days)
getVipDateByAccount(acc)
-- By Player
doTeleportPlayers(cid, topos)
getVipTime(cid)
setVipTime(cid, time)
getVipDays(cid)
isVip(cid)
addVipDays(cid, days)
doRemoveVipDays(cid, days)
getVipDate(cid)
]]--
-- Install
function installVip()
if db.executeQuery("ALTER TABLE `accounts` ADD viptime INT(15) NOT NULL DEFAULT 0;") then
print("[Vip System] Vip System instalado com sucesso!")
return TRUE
end
print("[Vip System] Não foi possível instalar o Vip System!")
return FALSE
end
-- By Account
function doTeleportPlayersByAccount(acc, topos)
if db.executeQuery("UPDATE `players` SET `posx` = "..topos.x..", `posy` = "..topos.y..", `posz` = "..topos.z.." WHERE `account_id` = "..acc..";") then
return TRUE
end
return FALSE
end
function getVipTimeByAccount(acc)
local vip = db.getResult("SELECT `viptime` FROM `accounts` WHERE `id` = "..acc..";")
if vip:getID() == -1 then
print("[Vip System] Account not found!")
return FALSE
end
return vip:getDataInt("viptime")
end
function setVipTimeByAccount(acc, time)
if db.executeQuery("UPDATE `accounts` SET `viptime` = "..time.." WHERE `id` = "..acc..";") then
return TRUE
end
return FALSE
end
function getVipDaysByAccount(acc)
local vipTime = getVipTimeByAccount(acc)
local timeNow = os.time()
local days = math.ceil((vipTime - timeNow)/(24 * 60 * 60))
return days <= 0 and 0 or days
end
function isVipAccount(acc)
return getVipDaysByAccount(acc) > 0 and TRUE or FALSE
end
function addVipDaysByAccount(acc, days)
if days > 0 then
local daysValue = days * 24 * 60 * 60
local vipTime = getVipTimeByAccount(acc)
local timeNow = os.time()
local time = getVipDaysByAccount(acc) == 0 and (timeNow + daysValue) or (vipTime + daysValue)
setVipTimeByAccount(acc, time)
return TRUE
end
return FALSE
end
function doRemoveVipDaysByAccount(acc, days)
if days > 0 then
local daysValue = days * 24 * 60 * 60
local vipTime = getVipTimeByAccount(acc)
local time = vipTime - daysValue
setVipTimeByAccount(acc, (time <= 0 and 1 or time))
return TRUE
end
return FALSE
end
function getVipDateByAccount(acc)
if isVipAccount(acc) then
local vipTime = getVipTimeByAccount(acc)
return os.date("%d/%m/%y %X", vipTime)
end
return FALSE
end
-- By Player
function doTeleportPlayers(cid, topos)
doTeleportPlayersByAccount(getPlayerAccountId(cid), topos)
end
function getVipTime(cid)
return getVipTimeByAccount(getPlayerAccountId(cid))
end
function setVipTime(cid, time)
return setVipTimeByAccount(getPlayerAccountId(cid), time)
end
function getVipDays(cid)
return getVipDaysByAccount(getPlayerAccountId(cid))
end
function isVip(cid)
return isVipAccount(getPlayerAccountId(cid))
end
function addVipDays(cid, days)
return addVipDaysByAccount(getPlayerAccountId(cid), days)
end
function doRemoveVipDays(cid, days)
return doRemoveVipDaysByAccount(getPlayerAccountId(cid), days)
end
function getVipDate(cid)
return getVipDateByAccount(getPlayerAccountId(cid))
end
talkaction:
Add.lua:
function onSay(cid, words, param, channel)
doPlayerSendCancel(cid, "Added "..param.." Vip Days.")
return doPlayerAddVipDays(cid, param)
end
Addvip.lua:
function onSay(cid, words, param)
if param == "" then
return doPlayerPopupFYI(cid,"Está com problemas?\n Aprenda os comandos!\n---------------\nAdicionar vip:\n/vip add days player\n/vip add 30 Styller\n---------------\nDeletar vip:\n/vip del player\n/vip del Styller\n---------------\nVer a vip:\n/vip see player\n/vip see Styller\n---------------\n")
end
if param:lower():find('add') == 1 and 3 then
local _,_,id,name = param:lower():find('add (%d+) (.+)')
name = name or ""
id = tonumber(id or 1) or 1
if tonumber(id) == nil or getPlayerByName(name) == false then
return doPlayerSendTextMessage(cid,25,"Adicionar vip:\n/vip add days player\n/vip add 30 Styller\n [Player: "..name.."]")
end
if isPlayer(getPlayerByName(name)) == TRUE then
vip.addVipByAccount(getPlayerAccount(getPlayerByName(name)) ,vip.getDays(id))
doPlayerSendTextMessage(cid,25,"Foram adicionados "..tonumber(id).." dias de vip a "..name..".")
doPlayerSendTextMessage(getPlayerByName(name),25,"Você recebeu "..tonumber(id).." dias de vip.")
else
doPlayerSendTextMessage(cid,25,name.." não esta online ou não existe.")
end
elseif param:lower():find('del') == 1 and 3 then
local _,_,name = param:lower():find('del (.+)')
if getPlayerByName(name) == false then
return doPlayerSendTextMessage(cid,25,"Deletar vip:\n/vip del player\n/vip del Styller\n")
end
vip.setVipByAccount(getPlayerAccount(getPlayerByName(name)),-os.time())
doPlayerSendTextMessage(cid,25,"A vip de "..name.." foi apagada.")
elseif param:lower():find('see') == 1 and 3 then
local _,_,name = param:lower():find('see (.+)')
name = name or ""
if getPlayerByName(name) == false then
return doPlayerSendTextMessage(cid,25,"Ver a vip:\n/vip see player\n/vip see Styller\n")
end
local ret_ = vip.getVip(getPlayerByName(name))
if ret_ == 0 then
return doPlayerSendTextMessage(cid, 25,name.." Não tem vip, e nunca teve.")
else
return doPlayerSendTextMessage(cid, 25, "A vip de "..name.." Acaba/terminou em "..os.date("%d %B %Y %X ",ret_))
end
end
return TRUE
end
Get.lua
function onSay(cid, words, param, channel)
doPlayerSendCancel(cid, ""..getPlayerVipDays(cid).." days VIP left.")
end
Is.lua
function onSay(cid, words, param, channel)
if isPlayerVip(cid) == TRUE then
doPlayerSendCancel(cid, "You are a VIP player.")
else
doPlayerSendCancel(cid, "You are not a VIP player.")
end
end
Remove.lua
function onSay(cid, words, param, channel)
doPlayerSendCancel(cid, "Vip removed.")
return doPlayerRemoveVip(cid)
end
Set.lua
function onSay(cid, words, param, channel)
doPlayerSendCancel(cid, "VIP Days: "..param..".")
return setPlayerVipDays(cid, param)
end
Vipdays.lua
function onSay(cid, words, param)
if vip.hasVip(cid) == TRUE then
doPlayerSendTextMessage(cid, 22, "Your vip end in "..os.date("%d %B %Y %X ",vip.getVip(cid)))
else
if vip.getVip(cid) ~= 0 then
doPlayerSendTextMessage(cid, 22, "You're not a vip player. Your vip has finished in "..os.date("%d %B %Y %X ", vip.getVip(cid)).." and now is "..os.date("%d %B %Y %X ", os.time()))
else
doPlayerSendTextMessage(cid, 22, "You're not a vip player. You naver has a vip.")
end
end
return TRUE
end
Aguardando Respostas! ^.^