Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

Galera, gostaria de saber como faço um sistema vip de compra pro meu server! tipo assim, quando digitar !buyvip ele adquire vip por 30 dias e tem acesso a uma area especial

Postado

Vai na pasta data/lib e cria um arquivo chamado 049-vipsys.lua e adiciona isso dentro:

vip = {

name = "Vip system";

author = "Mock";

version = "1.0.0.0";

query="ALTER TABLE `accounts` ADD `prem_days` INTEGER";

query2="ALTER TABLE `accounts` ADD `prem_days` INT(15) NOT NULL"

}

function vip.setTable()

dofile('config.lua')

if sqlType == "mysql" then

db.executeQuery(vip.query)

else

db.executeQuery(vip.query2)

end

end

function vip.getVip(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == FALSE then error('Player don\'t find') end;

ae = db.getResult("SELECT `vip_days` FROM `accounts` WHERE `name` = '"..getPlayerAccount(cid).."';")

if ae:getID() == -1 then

return 0

end

local retee = ae:getDataInt("vip_time") or 0

ae:free()

return retee

end

function vip.getVipByAcc(acc)

assert(acc,'Account is nil')

local a = db.getResult("SELECT `vip_days` FROM `accounts` WHERE `name` = '"..acc.."';")

if a:getID() ~= -1 then

return a:getDataInt("vip_time") or 0, a:free()

else

error('Account don\'t find.')

end

end

function vip.setVip(cid,time)

dofile("config.lua")

assert(tonumber(cid),'Parameter must be a number')

assert(tonumber(time),'Parameter must be a number')

if isPlayer(cid) == FALSE then error('Player don\'t find') end;

db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_days` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='".. getPlayerAccount(cid).."';")

end

function vip.getVipByAccount(acc)

assert(acc,'Account is nil')

return db.getResult("SELECT `vip_days` FROM `accounts` WHERE `name` = '"..acc.."';"):getDataInt("vip_time") or 0

end

function vip.hasVip(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == FALSE then return end;

local t = vip.getVip(cid) or 0

if os.time(day) < t then

return TRUE

else

return FALSE

end

end

function vip.hasVips(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == FALSE then return end;

local t = vip.getVip(cid)

if os.time(day) < t then

return TRUE

else

return FALSE

end

end

function vip.accountHasVip(acc)

assert(acc,'Account is nil')

if os.time() < vip.getVipByAccount(acc) then

return TRUE

else

return FALSE

end

end

function vip.getDays(days)

return (3600 * 24 * days)

end

function vip.addVipByAccount(acc,time)

assert(acc,'Account is nil')

assert(tonumber(time),'Parameter must be a number')

local a = vip.getVipByAcc(acc)

a = os.difftime(a,os.time())

if a < 0 then a = 0 end;

a = a+time

return vip.setVipByAccount(acc,a)

end

function vip.setVipByAccount(acc,time)

dofile("config.lua")

assert(acc,'Account is nil')

assert(tonumber(time),'Parameter must be a number')

db.executeQuery("UPDATE `accounts` SET `vip_days` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';")

return TRUE

end

function vip.returnVipString(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == TRUE then

return os.date("%d %B %Y %X ", vip.getVip(cid))

end

end

Agora vai na pasta data/talkactions e abre o arquivo talkactions.xml e adiciona essa tag:

Agora vai na pasta data/talkactions/scripts e cria um arquivo chamado buyvip.lua e coloca isso dentro:

function onSay(cid, words, param, channel)

vip.addVipByAccount(getPlayerAccount(cid), vip.getDays(30))

doPlayerRemoveItem(cid, 9971, 30)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce adquiriu 30 dias de VIP!")

return true

end

Ve aí se funciona. É pq aqui no meu ot tem esse sistema vip, mas ñ uso então ñ sei se ta tudo ok.

Se der certo, me avisa que aí eu bolo um jeito do player entrar na area vip. Mas eu queria saber o que vc tem em mente, se é tipo, o player falar <b>!flycityvip</b> (ou sei la) ou se vc qr um piso que cheque se o player é vip pra poder entrar.

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

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado
  • Autor

&nbsp;

Vai na pasta data/lib e cria um arquivo chamado 049-vipsys.lua e adiciona isso dentro:

vip = {

name = "Vip system";

author = "Mock";

version = "1.0.0.0";

query="ALTER TABLE `accounts` ADD `prem_days` INTEGER";

query2="ALTER TABLE `accounts` ADD `prem_days` INT(15) NOT NULL"

}

function vip.setTable()

dofile('config.lua')

if sqlType == "mysql" then

db.executeQuery(vip.query)

else

db.executeQuery(vip.query2)

end

end

function vip.getVip(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == FALSE then error('Player don\'t find') end;

ae = db.getResult("SELECT `vip_days` FROM `accounts` WHERE `name` = '"..getPlayerAccount(cid).."';")

if ae:getID() == -1 then

return 0

end

local retee = ae:getDataInt("vip_time") or 0

ae:free()

return retee

end

function vip.getVipByAcc(acc)

assert(acc,'Account is nil')

local a = db.getResult("SELECT `vip_days` FROM `accounts` WHERE `name` = '"..acc.."';")

if a:getID() ~= -1 then

return a:getDataInt("vip_time") or 0, a:free()

else

error('Account don\'t find.')

end

end

function vip.setVip(cid,time)

dofile("config.lua")

assert(tonumber(cid),'Parameter must be a number')

assert(tonumber(time),'Parameter must be a number')

if isPlayer(cid) == FALSE then error('Player don\'t find') end;

db.executeQuery("UPDATE `"..sqlDatabase.."`.`accounts` SET `vip_days` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='".. getPlayerAccount(cid).."';")

end

function vip.getVipByAccount(acc)

assert(acc,'Account is nil')

return db.getResult("SELECT `vip_days` FROM `accounts` WHERE `name` = '"..acc.."';"):getDataInt("vip_time") or 0

end

function vip.hasVip(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == FALSE then return end;

local t = vip.getVip(cid) or 0

if os.time(day) &amp;lt; t then

return TRUE

else

return FALSE

end

end

function vip.hasVips(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == FALSE then return end;

local t = vip.getVip(cid)

if os.time(day) &amp;lt; t then

return TRUE

else

return FALSE

end

end

function vip.accountHasVip(acc)

assert(acc,'Account is nil')

if os.time() &amp;lt; vip.getVipByAccount(acc) then

return TRUE

else

return FALSE

end

end

function vip.getDays(days)

return (3600 * 24 * days)

end

function vip.addVipByAccount(acc,time)

assert(acc,'Account is nil')

assert(tonumber(time),'Parameter must be a number')

local a = vip.getVipByAcc(acc)

a = os.difftime(a,os.time())

if a &amp;lt; 0 then a = 0 end;

a = a+time

return vip.setVipByAccount(acc,a)

end

function vip.setVipByAccount(acc,time)

dofile("config.lua")

assert(acc,'Account is nil')

assert(tonumber(time),'Parameter must be a number')

db.executeQuery("UPDATE `accounts` SET `vip_days` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='"..acc.."';")

return TRUE

end

function vip.returnVipString(cid)

assert(tonumber(cid),'Parameter must be a number')

if isPlayer(cid) == TRUE then

return os.date("%d %B %Y %X ", vip.getVip(cid))

end

end

Agora vai na pasta data/talkactions e abre o arquivo talkactions.xml e adiciona essa tag:

Agora vai na pasta data/talkactions/scripts e cria um arquivo chamado buyvip.lua e coloca isso dentro:

function onSay(cid, words, param, channel)

vip.addVipByAccount(getPlayerAccount(cid), vip.getDays(30))

doPlayerRemoveItem(cid, 9971, 30)

doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce adquiriu 30 dias de VIP!")

return true

end

Ve aí se funciona. É pq aqui no meu ot tem esse sistema vip, mas ñ uso então ñ sei se ta tudo ok.

Se der certo, me avisa que aí eu bolo um jeito do player entrar na area vip. Mas eu queria saber o que vc tem em mente, se é tipo, o player falar &lt;b&gt;!flycityvip&lt;/b&gt; (ou sei la) ou se vc qr um piso que cheque se o player é vip pra poder entrar.

&nbsp;

Quero um piso que cheque se o player é vip

Postado

Testa ae:

local back = getPlayerPosition(cid).y-1

local tile = ACTION_ID --ACTION ID DO TILE AQUI

function onStepIn(cid, item, pos)

if vip.getDays(days) &gt;= 1 then

if item.actionid == tile then

if vip.getDays(days) == 0 then

doPlayerSendCancel(cid,"Esta área é exclusiva para players Premium.")

doTeleportThing(cid, back)

else

end

end

end

end

Não esquece de botar o actionID do piso onde está escrito: tile = ACTION_ID

Não testei, pois não tenho sistema vip ligado no meu ot.

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

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

  • 4 weeks later...
Postado

O tópico foi movido para a área correta, preste mais atenção da próxima vez!

Leia as regras do fórum: http://tibiaking.com/forum/topic/1281-regras-gerais/?p=7680

Este tópico foi movido:

De: "OTServScriptingGeral"

Para: "OTServSuporte OTServSuporte de Scripts"

-"Supra Omnes Lux Lucis"

- Acima de todos brilha a Luz -

5VGnDyBz.png

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.7k

Informação Importante

Confirmação de Termo