Ir para conteúdo
  • 0

Modificar Door[Gfs]


Pergunta

Gente, queria apenas que ao invés da porta teleportar ela abrir e fechar apos player passar...

 

[GFS] 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 = 100,

FragsPerKill = 1,

AcessTimeDays = 1,

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,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="18998" 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

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 = 1000,

MyGuild = getPlayerGuildName(cid)

}

if isPlayer(cid) and isPlayer(target) and HaveGuild(cid) and HaveGuild(target) and getPlayerGuildId(cid) ~= getPlayerGuildId(target) 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, 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>

 

 

Grato, Sky.

Editado por SkyDevilFire
Link para o comentário
https://xtibia.com/forum/topic/196914-modificar-doorgfs/
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...