Postado Julho 7, 2014 10 anos Este é um post popular. Esse é um sistema de VIP por account, com comandos in game para adicionar/remover/checar dias de VIP. Para instalar crie Killua VIP System.lua em data/lib e coloque: -- Account VIP System criado por Vitor Bertolucci - Killua function installVipSystem() local func = db.query or db.executeQuery if func("CREATE TABLE `killua_vip_time` (`account_id` int(11) NOT NULL default '0', `time` varchar(255) NOT NULL default '0')") then return print(os.date("%X").." - Killua VIP System instalado com sucesso.") and true end return print(os.date("%X").." - Killua VIP System ja esta instalado.") and false end function getAccountVipTime(accid) local time_ = db.getResult("SELECT `time` FROM `killua_vip_time` WHERE `account_id` = '"..accid.."' LIMIT 1") if time_:getID() ~= -1 then return time_:getDataInt("time") end return false end function setAccountVipTime(accid, time) local func = db.query or db.executeQuery local time_ = db.getResult("SELECT `time` FROM `killua_vip_time` WHERE `account_id` = '"..accid.."' LIMIT 1") if time_:getID() ~= -1 then func("UPDATE `killua_vip_time` SET `time` = '"..time.."' WHERE `account_id` = '"..accid.."' LIMIT 1") time_:free() return true end return func("INSERT INTO `killua_vip_time` (`account_id`, `time`) VALUES ('"..accid.."', '"..time.."')") end function isVip(cid) if getAccountVipTime(getPlayerAccountId(cid)) then return getAccountVipTime(getPlayerAccountId(cid)) >= os.time() end return false end function doPlayerSetVipDays(cid, days) if days and tonumber(days) and tonumber(days) >= 0 then if tonumber(days) == 0 then return setAccountVipTime(getPlayerAccountId(cid), days) end return setAccountVipTime(getPlayerAccountId(cid), (os.time() + (days * 60 * 60 * 24))) end return print("Aviso: Nao foi possivel executar a funcao doPlayerAddVipDays. O parametro days deve ser um numero.") end function getPlayerVipDays(cid) if getAccountVipTime(getPlayerAccountId(cid)) then return getAccountVipTime(getPlayerAccountId(cid)) > 0 and math.ceil((getAccountVipTime(getPlayerAccountId(cid)) - os.time()) / 60 / 60 / 24) or 0 end return 0 end PS: Se na sua pasta lib já tiver algum arquivo com vip no nome, delete o arquivo. Em data/talkactions/scripst crie vip.lua e coloque: -- Account VIP System criado por Vitor Bertolucci - Killua function onSay(cid, words, param, channel) if param == "" then return doPlayerSendCancel(cid, "Utilize os parametros corretos.") end local t = string.explode(param, ',') if t[1] ~= "days" and getPlayerGroupId(cid) < 4 then return doPlayerSendCancel(cid, "Comandos disponiveis apenas para gods. Player podem usar /vip days") end if t[1] == "days" then if isVip(cid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce tem "..getPlayerVipDays(cid).." dias de VIP.") else doPlayerSendCancel(cid, "Voce nao tem VIP.") end elseif t[1] == "add" then if getPlayerByName(t[2]) and tonumber(t[3]) and tonumber(t[3]) > 0 then doPlayerSetVipDays(getPlayerByName(t[2]), getPlayerVipDays(getPlayerByName(t[2])) + tonumber(t[3])) doPlayerSendTextMessage(getPlayerByName(t[2]), 25, "Voce recebeu "..t[3].." dias de VIP.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[3].." dias de VIP adicionados para "..t[2]) else doPlayerSendCancel(cid, "Voce fez algo errado! Utilize /vip add, PLAYERNAME, dias.") end elseif t[1] == "remove" then if getPlayerByName(t[2]) and tonumber(t[3]) and tonumber(t[3]) > 0 then if isVip(getPlayerByName(t[2])) then if getPlayerVipDays(getPlayerByName(t[2])) > tonumber(t[3]) then doPlayerSetVipDays(getPlayerByName(t[2]), getPlayerVipDays(getPlayerByName(t[2])) - tonumber(t[3])) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[3].." dias de vip removidos de "..t[2]) doPlayerSendTextMessage(getPlayerByName(t[2]), MESSAGE_STATUS_WARNING, "Fora retirados "..t[3].." dias de VIP da sua account.") else doPlayerSetVipDays(getPlayerByName(t[2]), 0) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[2].." tinha menos que "..t[3].." dias de VIP. A VIP dele foi removida.") doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Sua VIP acabou.") end else doPlayerSendCancel(cid, t[2].." nao eh VIP.") end else doPlayerSendCancel(cid, "Voce fez algo errado! Utilize /vip remove, PLAYERNAME, dias.") end elseif t[1] == "check" then if getPlayerByName(t[2]) then if isVip(getPlayerByName(t[2])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[2].." tem "..getPlayerVipDays(getPlayerByName(t[2])).." dias de VIP Account.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, t[2].." nao eh VIP.") end else doPlayerSendCancel(t[2].." Nao esta online ou nao existe!") end elseif t[1] == "install" then if installVipSystem() then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O sistema foi instalado com sucesso.") else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O sistema ja esta instalado.") end end return true end E em talkactions.xml coloque: <talkaction words="/vip" event="script" value="vip.lua"/> Comandos: /vip install - instala o sistema /vip days - mostra quantos dias de VIP vc tem /vip add, NOMEDOPLAYER, dias - Adiciona dias de VIP à acc do jogador /vip remove, NOMEDOPLAYER, dias - Remove dias de VIP da acc do jogador /vip check, NOMEDOPLAYER - Mostra quantos dias de VIP o jogador tem Funções que fiz pro sistema e podem acabar sendo úteis: doPlayerSetVipDays(cid, days) getPlayerVipDays(cid) isVip(cid) Pronto. Vou por aqui tbm um piso que só jogadores VIP podem passar, usem esse script como base para criarem outros. Crie piso vip.lua em data/movements/scripts e coloque: function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor) if not isVip(cid) then doTeleportThing(cid, fromPosition) doPlayerSendCancel(cid, "Somente jogadores VIP podem passar.") doSendMagicEffect(fromPosition, CONST_ME_POFF) else doSendMagicEffect(toPosition, 12) end return true end E em movements.xml: <movevent type="StepIn" actionid="5723" event="script" value="piso vip.lua"/> Depois disso é só colocar actionID 5723 nos pisos que somente jogadores VIP podem passar. Editado Julho 7, 2014 10 anos por Killua (veja o histórico de edições) Meus trabalhos no fórum
Postado Julho 7, 2014 10 anos Boa perfeito rep+ ShopGuild Points 100% add em player offline. Dev c++ Compilando TFS no Windows [GlobalEvents] Perfect Lottery System(MySql) [GlobalEvents] ServeSave - Shutdown/Automático [Talkactions] Trade OFF - Shop Offline [Linux] Auto-Backup Database ShopGuild TFS 1.0PagSeguro Automático 100% Esse funciona![MYSQL] Backup_points Resetando e devolvendo os points automático.[LINUX] Montando OTserver em Debian perfeito.GesiorACC 2012 modificado o melhor!StreamTemple TFS 0.4 [8.60] MegaTibia
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.