Postado Junho 3, 2016 9 anos Este é um post popular. #UPDATE# V 1.1 - BUG DE BUGAR STORAGE AO FECHAR O SERVE REMOVIDO É um sistema onde mostra o tempo que o jogador ficou online no server... E tem mais alguns comandos adicionais: /stafftime NOME DO JOGADOR DA STAFFfaz com que mostre o tempo de determinado player da staff /allstafftimefaz com que mostre o tempo de todos os membros da staff /stafftimecleallReinicia o tempo de todos os membros da staff /stafftimeclear NOME DO JOGADOR DA STAFF Reinicia o tempo de determinado player da Staff Na pasta MODS: StaffTime.xml <?xml version="1.0" encoding="ISO-8859-1"?> <mod name="Staff Time System" version="1.1" author="vodkart" contact="none" enabled="yes"> <config name="stafftime_lib"><![CDATA[ _Staff_Config_ = { storages = {448507,448508,448509}, min_group_id = 1 -- aqui vai contar a partir do 2, 3, 4 ... } function timeString(timeDiff) local dateFormat = { {"day", timeDiff / 60 / 60 / 24}, {"hour", timeDiff / 60 / 60 % 24}, {"minute", timeDiff / 60 % 60}, {"second", timeDiff % 60} } local out = {} for k, t in ipairs(dateFormat) do local v = math.floor(t[2]) if(v > 0) then table.insert(out, (k < #dateFormat and (#out > 0 and ', ' or '') or ' and ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or '')) end end local ret = table.concat(out) if ret:len() < 16 and ret:find("second") then local a, b = ret:find(" and ") ret = ret:sub(b+1) end return ret end function getStaffTime(name) local target_online = getPlayerByNameWildcard(name) if not isPlayer(target_online) then local info = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[1]) if info:getID() ~= -1 then var_time = timeString((-(info:getDataInt("value")))) else var_time = 0 end else if getPlayerStorageValue(target_online, _Staff_Config_.storages[2]) <= 0 then var_time = 0 else var_time = timeString((os.time() - getPlayerStorageValue(target_online, _Staff_Config_.storages[1]))) end end return var_time end function getAllStaffTime() local query, str = db.getResult("SELECT `name`, `group_id` FROM `players` WHERE `group_id` > ".._Staff_Config_.min_group_id), "--> STAFF TIME <--\n\n[Group]Nick - Tempo Online\n" if (query:getID() ~= -1) then repeat local _ = query:getDataString("name") str = str .. "\n ["..getGroupInfo(query:getDataInt("group_id")).name.."]".._.." - "..getStaffTime(_) until not(query:next()) query:free() end return str end function doSaveStaffTime(cid) if getPlayerStorageValue(cid, _Staff_Config_.storages[2]) >= 1 then setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) - os.time()) setPlayerStorageValue(cid, _Staff_Config_.storages[3], getPlayerStorageValue(cid, _Staff_Config_.storages[1])) setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) + os.time()) end end function deleteAllStaffTimes() db.executeQuery("DELETE FROM `player_storage` WHERE `key` = ".._Staff_Config_.storages[1]) db.executeQuery("DELETE FROM `player_storage` WHERE `key` = ".._Staff_Config_.storages[2]) db.executeQuery("DELETE FROM `player_storage` WHERE `key` = ".._Staff_Config_.storages[3]) for _, player in ipairs(getPlayersOnline()) do if getPlayerGroupId(player) > _Staff_Config_.min_group_id then setPlayerStorageValue(player, _Staff_Config_.storages[1], os.time()) setPlayerStorageValue(player, _Staff_Config_.storages[2], 1) setPlayerStorageValue(player, _Staff_Config_.storages[3], 0) end end end function deletePlayerStaffTimes(name) local target_online = getPlayerByNameWildcard(name) if not isPlayer(target_online) then db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[1]) db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[2]) db.executeQuery("DELETE FROM `player_storage` WHERE `player_id` = ".. getPlayerGUIDByName(name) .." AND `key` = ".. _Staff_Config_.storages[3]) else setPlayerStorageValue(target_online, _Staff_Config_.storages[1], os.time()) setPlayerStorageValue(target_online, _Staff_Config_.storages[2], 1) setPlayerStorageValue(target_online, _Staff_Config_.storages[3], 0) end end ]]></config> <globalevent name="Salve-StaffTime" interval="30" event="script"><![CDATA[ domodlib('stafftime_lib') function onThink(interval, lastExecution, thinkInterval) if #getPlayersOnline() > 0 then for _, cid in ipairs(getPlayersOnline()) do if getPlayerGroupId(cid) > _Staff_Config_.min_group_id then doSaveStaffTime(cid) end end end return true end]]></globalevent> <globalevent name="StaffDebug-Start" type="start" event="buffer"><![CDATA[ domodlib('stafftime_lib') local q = db.getResult("SELECT `id` FROM `players` WHERE `group_id` > ".._Staff_Config_.min_group_id) if (q:getID() ~= -1) then repeat local p = q:getDataInt("id") u = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = "..p.." AND `key` = ".._Staff_Config_.storages[3]) if u:getID() ~= -1 then db.executeQuery("UPDATE `player_storage` SET `value` = "..(u:getDataInt("value")).." WHERE `player_id` = "..p.." AND `key` = ".. _Staff_Config_.storages[1]) end until not(q:next()) q:free() end return true]]></globalevent> <talkaction words="/stafftime;/allstafftime;/stafftimecleall;/stafftimeclear" event="buffer"><![CDATA[ domodlib('stafftime_lib') if (words == "/stafftime") then local t = string.explode(param:lower(), ",") if (param == "") then doPlayerSendCancel(cid, "use um comando valido") return true elseif not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Desculpe, mas o jogador [" .. t[1] .. "] não existe.") return true elseif db.getResult("SELECT `group_id` FROM `players` WHERE `id` = "..getPlayerGUIDByName(t[1])):getDataInt("group_id") <= _Staff_Config_.min_group_id then doPlayerSendCancel(cid,"este jogador não é um membro da staff.") return true end return doPlayerPopupFYI(cid, "Tempo Total Online:\n\n"..t[1].." - "..getStaffTime(t[1])..".") elseif (words == "/allstafftime") then if getPlayerAccess(cid) < 5 then doPlayerSendCancel(cid, "você não tem permissão para usar este comando") return true end return doPlayerPopupFYI(cid, getAllStaffTime()) elseif (words == "/stafftimecleall") then if getPlayerAccess(cid) < 5 then doPlayerSendCancel(cid, "você não tem permissão para usar este comando") return true end deleteAllStaffTimes() return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você limpou a Staff Time de toda a equipe do servidor.") elseif (words == "/stafftimeclear") then local t = string.explode(param:lower(), ",") if getPlayerAccess(cid) < 5 then doPlayerSendCancel(cid, "você não tem permissão para usar este comando") return true elseif (param == "") then doPlayerSendCancel(cid, "use um comando valido") return true elseif not getPlayerGUIDByName(t[1]) then doPlayerSendCancel(cid, "Desculpe, mas o jogador [" .. t[1] .. "] não existe.") return true elseif db.getResult("SELECT `group_id` FROM `players` WHERE `id` = "..getPlayerGUIDByName(t[1])):getDataInt("group_id") <= _Staff_Config_.min_group_id then doPlayerSendCancel(cid,"este jogador não é um membro da staff.") return true end deletePlayerStaffTimes(t[1]) return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você limpou a Staff Time do jogador "..t[1]) end ]]></talkaction> <event type="login" name="StaffTimeLogin" event="script"><![CDATA[ domodlib('stafftime_lib') function onLogin(cid) if getPlayerGroupId(cid) > _Staff_Config_.min_group_id then if getPlayerStorageValue(cid, _Staff_Config_.storages[2]) <= 0 then setPlayerStorageValue(cid, _Staff_Config_.storages[1], os.time()) setPlayerStorageValue(cid, _Staff_Config_.storages[2], 1) else setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) + os.time()) end end return true end]]></event> <event type="logout" name="StaffTimeLogout" event="script"><![CDATA[ domodlib('stafftime_lib') function onLogout(cid) if getPlayerGroupId(cid) > _Staff_Config_.min_group_id then setPlayerStorageValue(cid, _Staff_Config_.storages[1], getPlayerStorageValue(cid, _Staff_Config_.storages[1]) - os.time()) setPlayerStorageValue(cid, _Staff_Config_.storages[3], getPlayerStorageValue(cid, _Staff_Config_.storages[1])) end return true end]]></event> </mod> Editado Junho 4, 2016 9 anos por Vodkart (veja o histórico de edições) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Junho 3, 2016 9 anos Parabéns, seu tópico de conteúdo foi aprovado! Muito obrigado pela sua contribuição, nós do Tibia King agradecemos. Seu conteúdo com certeza ajudará à muitos outros, você recebeu +1 REP. Spoiler Congratulations, your content has been approved! Thank you for your contribution, we of Tibia King we are grateful. Your content will help many other users, you received +1 REP. Sdds vodkart _ .-'` `} _./) / } .'o \ | } '.___.'`.\ {` /`\_/ , `. } ME DA UMA NOZ! \=' .-' _`\ { `'`;/ `, } _\ @ ; } /__`;-...'--' Cluck!
Postado Junho 3, 2016 9 anos Recomendo, script perfeito !!!! Fugindo do assunto um pouco, o zombie sai amanha(sabado) mesmo ????
Postado Junho 4, 2016 9 anos ainda espero o dia que o vodkart vai liberar aquele sistema de npc/market Toda terça-feira um tópico novo: Descanso para curar mana (Spell): https://tibiaking.com/forums/topic/94615-spell-descanso-para-curar-mana/ Peça sua spell (Suporte): https://tibiaking.com/forums/topic/84162-peça-sua-spell/ Chuva de flechas (Spell): https://tibiaking.com/forums/topic/72232-chuva-de-flechas-spell/ Doom (Spell): https://tibiaking.com/forums/topic/51622-doom-spell/ Utilização do VS Code (Infra): https://tibiaking.com/forums/topic/94463-utilizando-o-visual-studio-code-notepad-nunca-mais/ SD com Combo (Spell): https://tibiaking.com/forums/topic/94520-sd-modificada/ Alteração attack speed (C++): https://tibiaking.com/forums/topic/94714-c-attack-speed-spells-itens-e-onde-você-quiser/ Bônus de Speed (NPC): https://tibiaking.com/forums/topic/94809-npc-concede-bônus-aos-players/
Postado Junho 4, 2016 9 anos Autor 4 minutos atrás, Reds disse: ainda espero o dia que o vodkart vai liberar aquele sistema de npc/market auction npc? ja liberei faz tempo [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.