Great idea... Thanks!
- Fórum
- OTServ
- Recursos
- Scripting
- Mods, funções e outros
- [Gfs] Guild Frag System
Muito bom, eu vi tu respondendo ao cara no tópico la..
Hey, when i kill other player frags don't add :E I don't have any error ;o but why frags don't add to guild?
Sorry, but i am other country User ![]()
É isso aí Vodkart, merece outro Rep+ nao so por ter me ajudado na hora que fiz o pedido, mas também por tá ajudando o pessoal. Ainda mais em mods!!! Parabéns cara!
@cykor119
I think that you need see if the players have less than 50 levels of difference. If the difference between the levels is longer than 50, the frag wont be add in rank. This was done to avoid power abuse ^^
Editado Abril 13 por Leoxtibia
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

Hey, when i kill other player frags don't add :E I don't have any error ;o but why frags don't add to guild?
Sorry, but i am other country User
The guild will Frag only if:
Killing each other with different IP (not to be abused)
Killing a player with different guild
Level diff 50 - (configurable)
--------------------------------------------------------------------
@edite
first update:
Honor point adicionado!
para saber mais leia o tópico
Editado Abril 14 por Vodkart
info
Grupo: Infante
Registrado: 13/10/08
Posts: 1.6k
Reputação: +420
Char no Tibia: Demonbholder

bom sistema, parabéns.
Editado Abril 14 por Demonbholder
muito bom o sistema, esse ai as mina pira
info
Grupo: Campones
Registrado: 04/01/12
Posts: 36
Reputação: 0
Char no Tibia: Sasuke

Antes de mais nada execute essas querys no seu banco de dados
ALTER TABLE `guilds` ADD `frags` INT(11) NOT NULL DEFAULT 0;
ALTER TABLE `guilds` ADD `acesstime` INT(15) NOT NULL DEFAULT 0;
eu nao entendi aonde eu adiciono isso aonde isso fika
abre tua sql la encima /\ nos botaozinho pra /\ > vai ter um Open sql query editor coloca isso no quadrado branco e aperta f9
info
Grupo: Campones
Registrado: 04/01/12
Posts: 36
Reputação: 0
Char no Tibia: Sasuke

puts meu sql bugo tipo nao consigo mais abrir mais nada la sera ke o computador ta foda isso faiz tempo ta assim eu vo tentar ir na casa de um amigo mais vc pode me ajudar se sabe oq pode ser?
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

puts meu sql bugo tipo nao consigo mais abrir mais nada la sera ke o computador ta foda isso faiz tempo ta assim eu vo tentar ir na casa de um amigo mais vc pode me ajudar se sabe oq pode ser?
editei o tópico explicando como executar as query
---------------------------------------------------------------------------------------
passando para quem quiser colocar sistema de reflect está aqui:
DamageGFS.lua
function onStatsChange(cid, attacker, type, combat, value)
local config = {damage_percent = 10,chance_percent = 40}
if type == STATSCHANGE_HEALTHLOSS and combat == COMBAT_PHYSICALDAMAGE then
if HaveAcess(getPlayerGuildName(cid)) and (config.chance_percent > math.random(1, 100)) then
damage = math.ceil((value*config.damage_percent)/100)
doTargetCombatHealth(cid, attacker, COMBAT_PHYSICALDAMAGE, -damage, -damage, CONST_ME_NONE)
doSendMagicEffect(getThingPosition(attacker), 39)
return true
end
end
return true
end
damage_percent = 10 -- qnto de damage sera relfetido está 10%
chance_percent = 40 -- qual a chance do damage ser refletido? esta 40%
tag:
<event type="statschange" name="DamageGuild" event="script" value="DamageGFS.lua"/>
adiciona ali em GuildFragsLogin.lua
registerCreatureEvent(cid, "DamageGuild")
Editado Abril 15 por Vodkart
info
Grupo: Campones
Registrado: 04/01/12
Posts: 36
Reputação: 0
Char no Tibia: Sasuke

ei vodkart da uma olhada la no capture frags se vc sauber ou tiver um sistema assim passa ae eu do rep +
MoreExpToGuild = false, -- se os jogadores receberam bonus de xpExp_Rate = 1.1, -- 10%
Isso aí é o que?
A guild que tiver com o "acesso" terá 10% mais exp? é isso?
info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino

MoreExpToGuild = false, -- se os jogadores receberam bonus de xpExp_Rate = 1.1, -- 10%
Isso aí é o que?
A guild que tiver com o "acesso" terá 10% mais exp? é isso?
isso mesmo, é uma exp bônus









info
Grupo: Herói
Registrado: 20/05/10
Posts: 3.4k
Reputação: +1.5k
Gênero: Masculino
Antes de mais nada execute essas querys no seu banco de dados
Não sabe executar a query? abra o spoiler e aprenda!
1° Abra o programa Sqlite
2° Selecione a database do seu server, o arquivo é esse ".s3db", por exemplo o "forgottenserver.s3db"
3° na parte superior do programa tem a aba "Tools",clica nela e seleciona "Open SQL query editor" ou (ALT + E) se preferir
4° Vai abrir uma janela branca,nela você coloca isso:
5° Depois clica no ícone do raio ali na parte de cima ou aperta o botão F9 que vai fazer com que a query seja executada.
Sistema
Lib/function
FragGuildSystem.lua
frag_guild = { start_frags = 120155, -- dont edit FragsToWinAcess = 100, -- to win guild acess FragsPerKill = 1, AcessTimeDays = 2, MoreExpToGuild = true, Exp_Rate = 1.1, -- 10% Honor_Storage = 215548, Honor_Point = 5 } 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 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 removeAcessGuildServer() return db.executeQuery("UPDATE guilds SET acesstime = 0;") 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 endActions
FragSystemDoor.lua
Tag:
Creaturescript
GuildFragsKill.lua
function onKill(cid, target, lastHit) local 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 endGuildFragsLogin.lua
Tag
globalevent
GuildFragsInfo.lua
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) endTag
talkactions
GuildFragsRank.lua
function onSay(cid, words, param) 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 endTag
Por Mod
Caso você queira usar o sistema por Mod aqui está:
Guild Frag System.xml
<?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 = 100, FragsPerKill = 1, AcessTimeDays = 2, MoreExpToGuild = false, Exp_Rate = 1.1, -- 10% Honor_Storage = 215548, Honor_Point = 5 } 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;/guildfrags;!myhonor;/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="1800" 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>Npc (obs: o NPC funciona caso você use MOD tbm)
Leia com atenção:
O jogador deverá ter gps na sua bag para comprar o item, porém os gps são serão removidos, somente os Honor Points.
Major Ancient.xml
<?xml version="1.0"?> <npc name="Major Ancient" script="data/npc/scripts/trade_honor.lua" walkinterval="50000" floorchange="0"> <health now="100" max="100"/> <look type="287" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Hello |PLAYERNAME|. I {trade} items for honor points!"/> </parameters> </npc>trade_honor.lua
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local Honor_Storage = 215548 function getHonorPoints(cid) local Honor = getPlayerStorageValue(cid, Honor_Storage) return Honor < 0 and 0 or Honor end local shopWindow = {} local t = { [2195] = {price = 5}, -- [id do item] e em price qnto honor points vai custar [2493] = {price = 25}, [2361] = {price = 30}, [8851] = {price = 20}, [8925] = {price = 30}, [2640] = {price = 50}, [2494] = {price = 100}, [9932] = {price = 50}, [2472] = {price = 70}, [8931] = {price = 100} } local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks) if t[item] and getHonorPoints(cid) < t[item].price then selfSay("you do not have "..t[item].price.." Honor Points", cid) else doPlayerAddItem(cid, item) setPlayerStorageValue(cid, Honor_Storage, getPlayerStorageValue(cid, Honor_Storage) - t[item].price) selfSay("Here you item", cid) end return true end if (msgcontains(msg, 'trade') or msgcontains(msg, 'TRADE'))then for var, ret in pairs(t) do table.insert(shopWindow, {id = var, subType = 0, buy = ret.price, sell = 0, name = getItemNameById(var)}) end openShopWindow(cid, shopWindow, onBuy, onSell) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())Configuração
Para configurar é simples, basta ir na lib e achar está tabela:
frag_guild = {
start_frags = 120155, -- não mexa
FragsToWinAcess = 100, -- qntos a guild tem q matar para ganhar o dominio
FragsPerKill = 1, -- qnto de frag ele ganha ao matar jogador da outra guild
AcessTimeDays = 2, -- qntos dias de acesso ele irá receber
MoreExpToGuild = false, -- se os jogadores receberam bonus de xp
Exp_Rate = 1.1, -- 10%
Honor_Storage = 215548, -- n edite
Honor_Point = 5 -- qntos de honor point players irao ganhar ao dominar
}
e só irá ganhar frag o jogador da guild que:
Matar outro com IP diferente (para não ter abuso)
Matar jogador de uma guild diferente( n ter bug se player da msm guild se matar)
Matar jogador com level de diferença até 50 (configurável)
Editado Junho 15 por Vodkart