Postado Janeiro 17, 2015 10 anos Então, eu uso esse mod do Vodkart de Guild Frag System, que da acesso aos jogadores vencedores que atingir X quantia de kills, porém não tem a parte do movement onde verifica se o jogador é da guild vencedora e se tem acesso e tals.... no script tem um action id no qual não funciono aqui, sempre muda pra outro numero na hora de por http://www.tibiaking.com/forum/topic/12235-gfs-guild-frag-system/ <?xml version="1.0" encoding="UTF-8"?> <mod name="Guild Frag System" version="1.0" author="Vodkart" contact="none" enabled="yes"> <config name="guild_func"><![CDATA[ frag_guild = { start_frags = 120155, FragsToWinAcess = 500, FragsPerKill = 1, AcessTimeDays = 2, MoreExpToGuild = false, Exp_Rate = 1.1, -- 10% Honor_Storage = 215548, Honor_Point = 10 } function getFragsByGuild(GuildName) local check = db.getResult("SELECT `frags` FROM `guilds` WHERE `id` = " ..getGuildId(GuildName)) return check:getDataInt("frags") <= 0 and 0 or check:getDataInt("frags") end function addFragsByGuild(GuildName,amount) db.executeQuery("UPDATE `guilds` SET `frags` = "..getFragsByGuild(GuildName).."+"..amount.." WHERE `guilds`.`id` = "..getGuildId(GuildName)) end function removeFragsByGuild(GuildName,amount) db.executeQuery("UPDATE `guilds` SET `frags` = "..getFragsByGuild(GuildName).."-"..amount.." WHERE `guilds`.`id` = "..getGuildId(GuildName)) end function setFragsByGuild(GuildName,value) db.executeQuery("UPDATE `guilds` SET `frags` = "..value.." WHERE `guilds`.`id` = "..getGuildId(GuildName)) end function cleanGuildFrags() db.executeQuery("UPDATE guilds SET frags = 0;") end function removeAcessGuildServer() return db.executeQuery("UPDATE guilds SET acesstime = 0;") end function getAcessTime(GuildName) local query = db.getResult("SELECT `acesstime` FROM `guilds` WHERE `id` = " ..getGuildId(GuildName)) if query:getID() ~= -1 then return query:getDataInt("acesstime") end end function HaveGuild(cid) return getPlayerGuildId(cid) > 0 and TRUE or FALSE end function doBroadCastGuild(GuildName,type,msg) local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerGuildName(cid) == GuildName then table.insert(players, cid) end end for i = 1, #players do doPlayerSendTextMessage(players[i],type,msg) end return true end function setAcessTime(GuildName, time) return db.executeQuery("UPDATE `guilds` SET `acesstime` = "..time.." WHERE `guilds`.`id` = "..getGuildId(GuildName)) end function getDaysAcess(GuildName) local acess = math.ceil((getAcessTime(GuildName) - os.time())/(86400)) return acess <= 0 and 0 or acess end function HaveAcess(GuildName) return getDaysAcess(GuildName) > 0 and TRUE or FALSE end function getGuildWinnerName() local guildname = '' local query = db.getResult("SELECT `name` FROM `guilds`;") if(query:getID() ~= -1) then repeat if HaveAcess(query:getDataString("name")) then guildname = query:getDataString("name") end until not query:next() query:free() end return guildname end function addAcess(GuildName, days) if days > 0 then local add = days*86400 local time = getDaysAcess(GuildName) == 0 and (os.time() + add) or (getAcessTime(GuildName) + add) return setAcessTime(GuildName, time) end return nil end function doRemoveAcess(GuildName, days) if days > 0 then local remove = days*86400 local time = getAcessTime(GuildName) - remove return setAcessTime(GuildName, (time <= 0 and 1 or time)) end return nil end function getAcessDate(GuildName) if HaveAcess(GuildName) then return os.date("%d/%m/%y %X", getAcessTime(GuildName)) end return FALSE end function getHonorPoints(cid) local Honor = getPlayerStorageValue(cid, frag_guild.Honor_Storage) return Honor < 0 and 0 or Honor end function addHonorPoints(GuildName, amount) local PlayersGuild = db.getResult("SELECT `name` FROM `players` WHERE `rank_id` IN (SELECT `id` FROM `guild_ranks` WHERE `guild_id` = " .. getGuildId(GuildName) .. ");") if (PlayersGuild:getID() ~= -1) then repeat local pid,Guid = getPlayerByNameWildcard(PlayersGuild:getDataString("name")),getPlayerGUIDByName(PlayersGuild:getDataString("name")) if(not pid or isPlayerGhost(pid)) then local getHonor = db.getResult("SELECT `value` FROM `player_storage` WHERE `player_id` = ".. Guid .." AND `key` = ".. frag_guild.Honor_Storage) if (getHonor:getID() ~= -1) then repeat db.executeQuery("UPDATE `player_storage` SET `value` = ".. (getHonor:getDataInt("value")+amount) .." WHERE `player_id` = ".. Guid .." AND `key` = ".. frag_guild.Honor_Storage) until not(getHonor:next()) getHonor:free() end else setPlayerStorageValue(getPlayerByName(PlayersGuild:getDataString("name")), frag_guild.Honor_Storage, getHonorPoints(getPlayerByName(PlayersGuild:getDataString("name")))+amount) end until not PlayersGuild:next() PlayersGuild:free() end return true end ]]></config> <talkaction words="!guildfrags;!myhonor" event="buffer"><![CDATA[ domodlib('guild_func') if words == "!myhonor" or words == "/myhonor" then return doPlayerPopupFYI(cid,"Honor Points can be exchanged for special items in npc\nAnd each domain, every guild players receive "..frag_guild.Honor_Point.." Honor Points!\n\n\nMy Honor Points: "..getHonorPoints(cid)) elseif words == "!guildfrags" or words == "/guildfrags" then if param == "rank" then local max_guild,str = 10,"" str = "--[ Rank Guild Frags ]--\n\n" query = db.getResult("SELECT `name`, `frags` FROM `guilds` WHERE `frags` ORDER BY `frags` DESC, `name` ASC;") if (query:getID() ~= -1) then k = 1 while true do str = str .. "\n " .. k .. ". " .. query:getDataString("name") .. " - [" .. query:getDataInt("frags") .. "]" k = k + 1 if not(query:next()) or k > max_guild then break end end query:free()end if str ~= "" then doPlayerPopupFYI(cid, str) end return true end doPlayerPopupFYI(cid,"".. (getGuildWinnerName() == "" and "The server does not have any dominant guild\n\nTo show the rank of frags enter !guildfrags rank" or "Currently guild dominant is ["..getGuildWinnerName().."]\n\nYour domain ends in "..getAcessDate(getGuildWinnerName()).."") .."") end return true ]]></talkaction> <event type="login" name="FragsGuildLogin" event="script"><![CDATA[ domodlib('guild_func') function onLogin(cid) registerCreatureEvent(cid, "FragsGuildLogin") registerCreatureEvent(cid, "FragsGuildKill") if getPlayerStorageValue(cid,frag_guild.Honor_Storage) == -1 then setPlayerStorageValue(cid, frag_guild.Honor_Storage, 0) end local MyGuild,StorCheck = getPlayerGuildName(cid),17595 if HaveGuild(cid) then if HaveAcess(MyGuild) then setPlayerStorageValue(cid, StorCheck, 1) if frag_guild.MoreExpToGuild == true then doPlayerSetExperienceRate(cid, frag_guild.Exp_Rate) end elseif getPlayerStorageValue(cid, StorCheck) == 1 and not HaveAcess(MyGuild) then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doPlayerPopupFYI(cid, "[Guild Frag System]\nThe domain of your guild is over and you've been teleported to the temple.") setPlayerStorageValue(cid, StorCheck, -1) if getGlobalStorageValue(frag_guild.start_frags) >= 1 then setGlobalStorageValue(frag_guild.start_frags, 0) end end end return TRUE end ]]></event> <action actionid="84005" event="script"><![CDATA[ domodlib('guild_func') function onUse(cid, item, frompos, item2, topos) local MyGuild = getPlayerGuildName(cid) if not HaveGuild(cid) then return doPlayerSendTextMessage(cid,22,"Sorry, you're not in a guild.") elseif not HaveAcess(MyGuild) then return doPlayerSendTextMessage(cid,22,"Your guild no has access to this area.") end doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, topos, TRUE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Welcome,The access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end]]></action> <event type="kill" name="FragsGuildKill" event="script"><![CDATA[ domodlib('guild_func') function onKill(cid, target, lastHit) config = { MaxDifLevel = 50, MyGuild = getPlayerGuildName(cid) } if isPlayer(cid) and isPlayer(target) and HaveGuild(cid) and HaveGuild(target) and getPlayerGuildId(cid) ~= getPlayerGuildId(target) and getPlayerIp(target) ~= getPlayerIp(cid) and math.abs(getPlayerLevel(cid) - getPlayerLevel(target)) <= config.MaxDifLevel and getGlobalStorageValue(frag_guild.start_frags) <= 0 then addFragsByGuild(config.MyGuild,frag_guild.FragsPerKill) doBroadCastGuild(config.MyGuild,20,'[Guild Frag System] Your guild received '..frag_guild.FragsPerKill..' frag because have killed a player another guild, now your guild have '..getFragsByGuild(config.MyGuild)..' frags') if getFragsByGuild(config.MyGuild) >= frag_guild.FragsToWinAcess then addAcess(config.MyGuild, frag_guild.AcessTimeDays) addHonorPoints(config.MyGuild, frag_guild.Honor_Point) doBroadcastMessage("[Guild Frag System]\nThe guild ["..config.MyGuild.."] is dominant for having achieved "..frag_guild.FragsToWinAcess.." Frags!\nYour domain ends in "..getAcessDate(config.MyGuild)) cleanGuildFrags() setGlobalStorageValue(frag_guild.start_frags, 1) if frag_guild.MoreExpToGuild == true then local players = {} for _, cid in pairs(getPlayersOnline()) do if getPlayerGuildName(cid) == config.MyGuild then table.insert(players, cid) end end for i = 1, #players do doPlayerSetExperienceRate(players[i], frag_guild.Exp_Rate) end end end end return TRUE end]]></event> <globalevent name="GuildFrags" interval="3600000" event="script"><![CDATA[ domodlib('guild_func') function onThink(interval, lastExecution) if getGuildWinnerName() == "" and getGlobalStorageValue(frag_guild.start_frags) >= 1 then setGlobalStorageValue(frag_guild.start_frags, 0) end return doBroadcastMessage("".. (getGuildWinnerName() == "" and "[Guild Frag System]\nThe first guild to reach "..frag_guild.FragsToWinAcess.." frags will gain "..frag_guild.AcessTimeDays.." days of access to exclusive areas, for more information enter !guildfrags" or "[Guild Frag System]\nCurrently guild dominant is ["..getGuildWinnerName().."] and your domain ends in "..getAcessDate(getGuildWinnerName()).."") .."", 22) end]]></globalevent> </mod> (1º) | [8.60] - Galaxy Server - Download (2º) | [8.60] - Glorious Server - Download (3º) | [8.60] - Epic Server - Download
Postado Janeiro 19, 2015 10 anos Autor up (1º) | [8.60] - Galaxy Server - Download (2º) | [8.60] - Glorious Server - Download (3º) | [8.60] - Epic Server - Download
Postado Janeiro 19, 2015 10 anos Tenta esse movement: function onStepIn(cid, item, position, fromPosition) local guild = getPlayerGuildName(cid) if not isPlayer(cid) then return true elseif not HaveGuild(cid) then return doPlayerSendCancel(cid, "Sorry, you're not in a guild.") and doTeleportThing(cid, fromPosition) elseif not HaveAcess(guild) then return doPlayerSendCancel(cid, "Your guild no has access to this area.") and doTeleportThing(cid, fromPosition) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome, the access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end não respondo pms solicitando suporte em programação/scripting
Postado Janeiro 19, 2015 10 anos Autor Tenta esse movement: function onStepIn(cid, item, position, fromPosition) local guild = getPlayerGuildName(cid) if not isPlayer(cid) then return true elseif not HaveGuild(cid) then return doPlayerSendCancel(cid, "Sorry, you're not in a guild.") and doTeleportThing(cid, fromPosition) elseif not HaveAcess(guild) then return doPlayerSendCancel(cid, "Your guild no has access to this area.") and doTeleportThing(cid, fromPosition) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome, the access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end (1º) | [8.60] - Galaxy Server - Download (2º) | [8.60] - Glorious Server - Download (3º) | [8.60] - Epic Server - Download
Postado Janeiro 19, 2015 10 anos Solução Coloquei fora do mod, my bad. Troca: <action actionid="84005" event="script"><![CDATA[ domodlib('guild_func') function onUse(cid, item, frompos, item2, topos) local MyGuild = getPlayerGuildName(cid) if not HaveGuild(cid) then return doPlayerSendTextMessage(cid,22,"Sorry, you're not in a guild.") elseif not HaveAcess(MyGuild) then return doPlayerSendTextMessage(cid,22,"Your guild no has access to this area.") end doTransformItem(item.uid, item.itemid + 1) doTeleportThing(cid, topos, TRUE) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Welcome,The access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end]]></action> por: <movevent type="StepIn" actionid="9089" event="script"><![CDATA[ domodlib("guild_func") function onStepIn(cid, item, position, fromPosition) local guild = getPlayerGuildName(cid) if not isPlayer(cid) then return true elseif not HaveGuild(cid) then return doPlayerSendCancel(cid, "Sorry, you're not in a guild.") and doTeleportThing(cid, fromPosition) elseif not HaveAcess(guild) then return doPlayerSendCancel(cid, "Your guild no has access to this area.") and doTeleportThing(cid, fromPosition) end doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome, the access of your guild in this area ends in "..getAcessDate(getGuildWinnerName())) return true end]]></movement> PS: Não mexo com MODs, então não é certeza que vai funcionar. Mas não custa tentar. não respondo pms solicitando suporte em programação/scripting
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.