Postado Dezembro 18, 2012 12 anos Administrador VIP System by Mock 100% Fala galerinha do TK, então, há muito tempo atrás lá para meados de 2010 eu e alguns amigos pegamos um sistema de VIP inacabado pelo tão famoso scripter Mock e finalizamos ele deixando-o perfeito para uso, enfim, eu não achei esse script aqui no fórum e resolvi compartilhar com vocês, espero que gostem, confiram:1° - Acesse a pasta data/lib e crie um arquivo chamado 049-vipsys.lua, coloque isso dentro do arquivo:vip = { name = "VIP System"; author = "Mock"; version = "1.0.0.0"; query="ALTER TABLE `accounts` ADD `vip_time` INTEGER"; query2="ALTER TABLE `accounts` ADD `vip_time` INT(15) NOT NULL" } function vip.setTable() dofile('config.lua') if sqlType == "sqlite" 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_time` 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_time` 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_time` = '"..(os.time()+time).."' WHERE `accounts`.`name` ='".. getPlayerAccount(cid).."';") end function vip.getVipByAccount(acc) assert(acc,'Account is nil') return db.getResult("SELECT `vip_time` 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_time` = '"..(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 2° - Abra a pasta data/creaturescrpits/scripts e crie um arquivo chamado fimvip.lua, dentro dele adicione:By Lukeskywalkerfunction onLogin(cid) local temple = { x =32369, y = 32246, z = 6} if vip.hasVip(cid) == true then if getPlayerStorageValue(cid,55555) ~= 1 then setPlayerStorageValue(cid,55555,1) end else if getPlayerStorageValue(cid,55555) == 1 then doTeleportThing(cid, temple) doPlayerSendTextMessage(cid, 22, "Your VIP Time over!") db.executeQuery("UPDATE `accounts` SET `vip_time` = 0 WHERE `id` = ".. getAccountIdByName(getPlayerName(cid)) ..";") setPlayerPromotionLevel(cid, 1) setPlayerStorageValue(cid, 55555, 0) end end return true end Você pode troca as coordenadas do templo: local temple = {x=32369, y=32246, z=6}.3° - Em data/creaturescripts/scripts/login.lua adicione essas tags:registerCreatureEvent(cid, "FimVip") registerCreatureEvent(cid, "VipReceive") 4° - Em data/creaturescripts/creaturescripts.xml adicione está tag:<event type="login" name="FimVip" event="script" value="fimvip.lua"/> 5º - Em data\movements\scripts e crie um arquivo chamado viptile.lua e adicione isso dentro dele:function onStepIn(cid, item, position, fromPosition) local tileConfig = { kickPos = fromPosition, kickEffect = CONST_ME_POFF, kickMsg = "You need to be a vip player to access this area.", enterMsg = "Welcome to vip area!", enterEffect = CONST_ME_MAGIC_RED, } if isPlayer(cid) == true then if vip.hasVip(cid) == FALSE then doTeleportThing(cid, tileConfig.kickPos) doSendMagicEffect(tileConfig.kickPos, tileConfig.kickEffect) doPlayerSendCancel(cid, tileConfig.kickMsg) return end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, tileConfig.enterMsg) doSendMagicEffect(position, tileConfig.enterEffect) return true end end 6° - Em data\movements\movements.xml adicione a tag:<movevent type="StepIn" actionid="13500" event="script" value="viptile.lua"/> Vejam a numeração 13500 você irá usar no tile que você quer para a passagem de player VIP para configurar adicione a numeração em ActionID do tile.7° - Em data/talkactions/scripts acrescente dentro da pasta scripts uma outra pasta com o nome VIP vamos precisar de 7 arquivos.lua que teram os nomes e códigos a seguir:add.luafunction onSay(cid, words, param, channel) doPlayerSendCancel(cid, "Added "..param.." Vip Days.") return doPlayerAddVipDays(cid, param) end addvipp.luafunction onSay(cid, words, param) if param == "" then return doPlayerPopupFYI(cid,"Está com problemas?\nAprenda os comandos!\n---------------\nAdicionar vip:\n/vip add days player\n/vip add 30 Real\n---------------\nDeletar vip:\n/vip del player\n/vip del Real\n---------------\nVer a vip:\n/vip see player\n/vip see Real\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,MESSAGE_INFO_DESCR,"Adicionar vip:\n/vip add days player\n/vip add 30 Real\n [Player: "..name.."]") end if isPlayer(getPlayerByName(name)) == TRUE then vip.addVipByAccount(getPlayerAccount(getPlayerByName(name)) ,vip.getDays(id)) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"Foram adicionados "..tonumber(id).." dias de vip a "..name..".") doPlayerSendTextMessage(getPlayerByName(name),MESSAGE_INFO_DESCR,"Você recebeu "..tonumber(id).." dias de vip.") else doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,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,MESSAGE_INFO_DESCR,"Deletar vip:\n/vip del player\n/vip del Real\n") end vip.setVipByAccount(getPlayerAccount(getPlayerByName(name)),-os.time()) doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"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,MESSAGE_INFO_DESCR,"Ver a vip:\n/vip see player\n/vip see Real\n") end local ret_ = vip.getVip(getPlayerByName(name)) if ret_ == 0 then return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,name.." Não tem vip, e nunca teve.") else return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "A vip de "..name.." Acaba/terminou em "..os.date("%d %B %Y %X ",ret_)) end end return TRUE end get.luafunction onSay(cid, words, param, channel) doPlayerSendCancel(cid, ""..getPlayerVipDays(cid).." days VIP left.") end is.luafunction 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 removevip.luafunction onSay(cid, words, param, channel) doPlayerSendCancel(cid, "Vip removed.") return doPlayerRemoveVip(cid) end set.luafunction onSay(cid, words, param, channel) doPlayerSendCancel(cid, "VIP Days: "..param..".") return setPlayerVipDays(cid, param) end vipdays.luafunction onSay(cid, words, param) if vip.hasVip(cid) == TRUE then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your vip end in "..os.date("%d %B %Y %X ",vip.getVip(cid))) else if vip.getVip(cid) ~= 0 then doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "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, MESSAGE_INFO_DESCR, "You're not a vip player. You naver has a vip.") end end return TRUE end 8° - Em data/talkactions/talkactions.xml adicione está tag:<!-- VIP System --> <talkaction log="yes" words="/vip" access="5" event="script" value="VIP/addvipp.lua" /> <talkaction words="!vipdays" event="script" value="VIP/vipdays.lua" /> 9° - Para finalizar execute este comando na sua database:ALTER TABLE `accounts` ADD `vip_time` INT NOT NULL; Bom galera este sistema vip adiciona os dias corretos e ao termino do VIP o player recebe a mensagem que a VIP acabou e é teletransportado para o templo.Créditos:Mock (por ter iniciado algo e não terminou)Lukeskywalker (Sistema de finalização perfeito do vip)Matheus [Eu] (Por ter feito várias alterações nas talkacions)Natan Beckman (Por ter ido atrás da conclusão 100% in game e php)Você gostou deste conteúdo!? Este conteúdo te ajudou!? Isso será realmente útil pra você!?Então, se possível, faça uma doação (de qualquer valor) que estará me ajudando também! TibiaKing Team- KingTópicos www.tibiaking.com
Postado Dezembro 18, 2012 12 anos Obrigado Matheus Foi Muito Util para mim! vou usa-lo! Editado Dezembro 18, 2012 12 anos por Deft (veja o histórico de edições) Servidor Exbaiak
Postado Dezembro 18, 2012 12 anos Topico Bem Feito Reputado . Pra Quem Curte Um " Hard Rock , Metal , Industrial , Classicos " Curtão Minha Radio Online Pessoal .
Postado Dezembro 18, 2012 12 anos Tópico muito bom, bem estruturado e com um ótimo conteúdo! Reputado Concerteza Atenciosamente, Avuenja. OTAAC | TIBIA CLIENTS
Postado Janeiro 16, 2013 12 anos Tópico muito bem feito! mas como posso adicionar tempo VIP ao player? e se for por comando de gm, como botar x dias ? Só não te dou REP+ pq não sei onde fica hahahahaha ( acc velha, mas comecei a acessar o site há pouco tempo ) se me explicar como da rep eu dou =) Editado Janeiro 16, 2013 12 anos por cianovs (veja o histórico de edições)
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.