Ir para conteúdo

[Gfs] Guild Frag System


Vodkart

Posts Recomendados

@Vodkart essa id da door esta certa? Quando vou por na porta, vira "65535"

 

Não é o id da porta, é o actionid dela que é 84005

 

obs: aconselho a usar aquelas expertise door

Link para o comentário
Compartilhar em outros sites

É porque na maioria dos servers, o actionid vai somente até esse número: 65535... se você está usando o sistema por MOD, é só trocar aqui nessa linha:

 

<action actionid="84005" event="script"><![CDATA[

Link para o comentário
Compartilhar em outros sites

É porque na maioria dos servers, o actionid vai somente até esse número: 65535... se você está usando o sistema por MOD, é só trocar aqui nessa linha:

 

<action actionid="84005" event="script"><![CDATA[

 

Vish, ainda não funciono, vo aceitar a proposta dele por TILE, bem mais facil ;P

 

versão MODS

 

 

está aí:

 

 

 

<?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>
<movevent type="StepIn" actionid="45000" event="script"><![CDATA[
domodlib('guild_func')
function onStepIn(cid, item, position, fromPosition)
local MyGuild = getPlayerGuildName(cid)
if not HaveGuild(cid) or not HaveAcess(MyGuild) then
doTeleportThing(cid, fromPosition, true)
doPlayerSendTextMessage(cid, 22, not HaveGuild(cid) and "Sorry, you're not in a guild." or "Your guild no has access to this area.") 
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_BLUE)
return true
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,"Welcome,The access of your guild in this area ends in "..getAcessDate(getGuildWinnerName()))
return true
end]]></movevent>
<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>

 

 

é só colocar no ACTIONID do seu tile 45000

Link para o comentário
Compartilhar em outros sites

Quando abro o servidor ele fica repetindo a msg sem parar:

 

[guild frag system] the first guild to reach 50 frags will gain 5 days of acess to exclusive areas, for more information enter !guildfrags.

 

 

uso MOD.

 

___

 

eqsquece, já resolvi =P

Editado por Lolksky
Link para o comentário
Compartilhar em outros sites

  • 3 weeks later...

aque ta dando esse error :X

 

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

Link para o comentário
Compartilhar em outros sites

aque ta dando esse error :X

 

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

[22/09/2012 00:33:26] Error during getDataInt(acesstime).

 

vc n executou a query que foi pedida no topico

Link para o comentário
Compartilhar em outros sites

  • 4 weeks later...
×
×
  • Criar Novo...