Ir para conteúdo
  • 0
bitoca1995

Scripting [BUG] talkactions CITYWAR.LUA

Pergunta

bitoca1995    0
bitoca1995

Boa tarde,

 

Instalei o citywar no meu server ( war anti-entrosa ), porem está com 2 bugs, o primeiro que é o mais critico, é que a primeira war funciona normalmente, os players dão /citywar go e vão para a cidade privada, porem na segunda vez, funciona também normalmente, porem na hora de usar o /citywar go dá um erro na distro e o comando não funciona para o player. Esse comando só volta a funcionar, quando do reload nas talkactions, segue a img do erro: 

image.png.f7c7c0e52c9a91be112a321302be0355.png

O citywar.lua talkactions:

Spoiler

-- /citywar invite, guild, cidade, numero, modo, tempo
local function cityWarInvite(cid, param)

local guildId = getGuildId(param[2])
	if guildId == false then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid guild name.")
		return false
	end
	if guildId == getPlayerGuildId(cid) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid guild invite.")
		return false	
	end
	if isGuildAntiEntrosa(guildId) or isGuildAntiEntrosa(getPlayerGuildId(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Guild already on war.")
		return false		
	end
local nomeB = param[2]
	
	--if not cityWarExtraRequirements(cid, guildId) then
		--return false
	--end	
local ret, instance = isInAnyArray(War.cidade_string, param[3])
	if ret then		
		instanceid = Instance:getFree(instance)
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid city name.")
		return false
	end
	
local numero = 0
	if tonumber(param[4]) and isInAnyArray(War.numero, tonumber(param[4])) then
		numero = tonumber(param[4])
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid number of players.")
		return false
	end
	
local ret, modo = isInAnyArray(War.modo_string, param[5])
	if not ret then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid type name.")
		return false
	end

local preco, tempo = 0, 0
	if tonumber(param[6]) then
		tempo = tonumber(param[6])
		ret, preco = isInAnyArray(War.tempo, tonumber(param[6]))
		if not ret then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid duration time.")
			return false
		end
		if not doPlayerWithdrawMoney(cid, War.preco[preco]) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough money.")
			return false			
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid duration time.")
		return false
	end		

local config = {
	desafiante = cid,
	nomeA = getPlayerGuildName(cid),
	nomeB = nomeB,
	tempo = tempo,
	valor = War.preco[preco],
	modo = modo,
	numero = numero,
	cidade = instance,
	instanceid = instanceid,
	guildA = getPlayerGuildId(cid),
	guildB = guildId
}

	Wars(config)
end

-- /citywar accept, guild
local function cityWarAccept(cid, param)
local selfGuild = getPlayerGuildId(cid)
local invitingGuild = getGuildId(param[2])
	for _, v in pairs(Wars) do
		if type(v) == 'table' then
			if v:isGuildOnWar(invitingGuild) and v:isGuildOnWar(selfGuild) then
				if doPlayerWithdrawMoney(cid, v.valor) then
					v:start()
				else
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Not enough money.")
				end
			end
		end
	end
end

-- /citywar go
local function cityWarGo(cid)
selfGuild = getPlayerGuildId(cid)
	for _, v in pairs(Wars) do
		if not v == false then
			if v:isGuildOnWar(selfGuild) then
				if getTileInfo(getThingPosition(cid)).protection == false then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please go to a protection zone.")
					return true
				end
				return v:newPlayer(cid)
			end
		end
	end
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your guild is not in a war.")
end

-- /citywar exit
local function cityWarExit(cid)
	if getPlayerWarType(cid) <= 0 then
		return false
	end
	selfGuild = getPlayerGuildId(cid)
	for _, v in pairs(Wars) do
		if type(v) == 'table' then
			if v:isGuildOnWar(selfGuild) then
				if getTileInfo(getThingPosition(cid)).protection == false then
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Please go to a protection zone.")
					return true
				end
				v:removePlayer(cid)
			end
		end
	end
end

function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end	

	local t = string.explode(param, ",")
	local ret = RETURNVALUE_NOERROR

	local comando = t[1]
	if comando == "accept" then
		if isGuildLeader(cid) then
			if getPlayerWarType(cid) < 1 then
				cityWarAccept(cid, t)
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already in a war.")	
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not a guild leader.")			
		end
	elseif comando == "invite" then
		if isGuildLeader(cid) then
			if getPlayerWarType(cid) < 1 then
				cityWarInvite(cid, t)
			else
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are already in a war.")	
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not a guild leader.")			
		end
	elseif comando == "go" then
		if not cityWarGo(cid) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player number limit reached.")			
		end
	elseif comando == "exit" then
		if not cityWarExit(cid) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are not in war.")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid command param.")
	end
	return true
end

 

E o segundo bug, não tão critico, mas que atrapalha muito, é que quando uso o /citywar exit, para o player sair da cidade privada, ele fala que o player não está em war, mesmo estando. Alguem pode me ajudar por favor?

 

Obrigado.

 

Editado por Majesty
Código em spoiler.

Compartilhar este post


Link para o post
Compartilhar em outros sites

5 respostass a esta questão

Recommended Posts

  • 0
Majesty    1755
Majesty

A questão neste tópico de suporte foi respondida, mas não foi possível para o autor do tópico resolver a questão. Este tópico está fechado agora. Se você tiver outras perguntas, crie um novo tópico.

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Majesty    1755
Majesty

Encontrei um sistema de war anti-entrosa diferente, tente adaptar em seu servidor e veja se funciona:

https://mega.nz/#!CBETkAyY!bm1ebrpYm2uH_iZhnw64YF1Dc9JOHsIU-iz4SmnHHfI

Testado somente em TFS 0.4 (8.6).

Créditos: Killua / Vitor Bertolucci.

Observação: sem suporte a eventuais dúvidas, problemas, erros.

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
bitoca1995    0
bitoca1995

@Majesty tem algum topico referente a esse sistema, ou sómente o arquivo?

 

de qualquer forma vou verificar aqui, obrigado.

@Majesty testei e esse quando da !war go, ele fala que entrou na war, porem não teleporta o player :(

Editado por bitoca1995

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
Majesty    1755
Majesty

Encontrei mais opções de sistema de war anti-entrosa.

1ª opção: https://www.sendspace.com/file/2l6id9

Créditos: - .

Provavelmente é o mesmo que você instalou, porque possui os mesmos bugs relatados. 

Vai ter que encontrar alguém que possa corrigir esses bugs.

2ª opção:

Creaturescript:

Spoiler

function onLogout(cid)
    if getPlayerStorageValue(cid, 888123) > os.time() then
        doPlayerSendCancel(cid, "Vc n pode logar enquanto esta em war! Espere "..getPlayerStorageValue(cid, 888123) - os.time().." segundos.")
        return false
    end
    return true
end

 

Talkaction:

Spoiler

local arena_storage = 454523
local players_storage = 456512
local storage_accept = 151230
local storage_check = 153201
local guild_invite = 542351
local guild_accept = 456121
local time_1_pos = {x = 26366, y = 31962, z = 6}
local time_2_pos = {x = 26484, y = 31957, z = 6}
local city = "Carlin"

local function getOnlineGuildMembersByRank(guildId, rank, selectLowerRanks) -- Funcao feita pelo Omega
    if not rank then
        rank = 3
        selectLowerRanks = true
    end
    local list = {}
    for _, pid in pairs(getPlayersOnline()) do
        if getPlayerGuildId(pid) == guildId then
            local playerRank = getPlayerGuildLevel(pid)
            if playerRank == rank or (selectLowerRanks and playerRank <= rank) then
                table.insert(list, pid)
            end
        end
    end
    return list
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendCancel(cid, "Use os parametros corretos.")
        return true
    end
    
    local t = string.explode(param, ",")
    
    if words == "!war"..city.." invite," then
        
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false) > 0 then
                if getGlobalStorageValue(arena_storage) <= os.time() then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce convidou a guild "..t[2].." para uma war em "..city.."!")
                    for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureName(cid).." da guild "..getPlayerGuildName(cid).." chamou sua guild para uma war em "..city.." Para aceitar diga /war"..city.." accept, "..getPlayerGuildName(cid)..".")
                        setPlayerStorageValue(gid, storage_accept, os.time() + 20*60)
                        setPlayerStorageValue(gid, storage_check, getPlayerGuildId(cid))
                    end
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A arena ja esta ocupada.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nenhum lider da guild "..t[2].." esta online.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    
    
    elseif "!war"..city.." accept," then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if getPlayerStorageValue(cid, storage_accept) > os.time() then
                if getPlayerStorageValue(cid, storage_check) == getGuildId(t[2]) then
                    setGlobalStorageValue(arena_storage, os.time() + 3600)
                    setGlobalStorageValue(guild_accept, getPlayerGuildId(cid))
                    setGlobalStorageValue(guild_invite, getGuildId(t[2]))
                    if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true) > 0 then
                        for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..getPlayerGuildName(cid).."! Para participar diga /war"..city.." go")
                        end
                    end
                    if #getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true) > 0 then
                        for _, pid in pairs(getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true)) do
                            doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..t[2].."! Para participar diga /war"..city.." go")
                        end
                    end
                    addEvent(function()
                        for _, pid in pairs(getPlayersOnline()) do
                            if isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 3}, {x = 26507, y = 32030, z = 3}) or isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 4}, {x = 26507, y = 32030, z = 4}) or isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 5}, {x = 26507, y = 32030, z = 5}) or isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 6}, {x = 26507, y = 32030, z = 6}) or isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 7}, {x = 26507, y = 32030, z = 7}) or isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 8}, {x = 26507, y = 32030, z = 8}) or isInArea(getThingPos(pid), {x = 26357, y = 31906, z = 9}, {x = 26507, y = 32030, z = 9}) then
                                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi teleportado para o templo pq o tempo de war acabou")
                            end
                        end
                    end, 1000*3600)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_accept, -1)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_invite, -1)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao te invitou para uma war.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild n foi chamada para nenhuma war.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif "!war"..city.." go" then
        if getTilePzInfo(getThingPos(cid)) == false then
            doPlayerSendCancel(cid, "Vc precisa estar na pz")
            return true
        end
        if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) or getGlobalStorageValue(guild_accept) == getPlayerGuildId(cid) then
            doPlayerSetStorageValue(cid, 888123, os.time() + getGlobalStorageValue(arena_storage))
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce entrou na war!")
            if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) then
                doTeleportThing(cid, time_1_pos)
            else
                doTeleportThing(cid, time_2_pos)
            end
        else
            doPlayerSendCancel(cid, "Sua guild nao esta em war")
        end
    end
    return true
end

 

War anti-entrosa Edron:

Spoiler

local arena_storage = 454642
local players_storage = 456487
local storage_accept = 151819
local storage_check = 153048
local guild_invite = 542114
local guild_accept = 456318
local time_1_pos = {x = 24519, y = 32292, z = 7}
local time_2_pos = {x = 24525, y = 32241, z = 6}
local city = "edron"

local function getOnlineGuildMembersByRank(guildId, rank, selectLowerRanks) -- Funcao feita pelo Omega
    if not rank then
        rank = 3
        selectLowerRanks = true
    end
    local list = {}
    for _, pid in pairs(getPlayersOnline()) do
        if getPlayerGuildId(pid) == guildId then
            local playerRank = getPlayerGuildLevel(pid)
            if playerRank == rank or (selectLowerRanks and playerRank <= rank) then
                table.insert(list, pid)
            end
        end
    end
    return list
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendCancel(cid, "Use os parametros corretos.")
        return true
    end
    
    if getPlayerLevel(cid) <= 30 then
        doPlayerSendCancel(cid, "Voce nao tem level suficiente.")
        return true
    end
    
    local t = string.explode(param, ",")
    
    if t[1] == "invite" then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false) > 0 then
                if getGlobalStorageValue(arena_storage) <= os.time() then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce convidou a guild "..t[2].." para uma war em "..city.."!")
                    for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureName(cid).." da guild "..getPlayerGuildName(cid).." chamou sua guild para uma war em "..city.." Para aceitar diga /war"..city.." accept, "..getPlayerGuildName(cid)..".")
                        setPlayerStorageValue(gid, storage_accept, os.time() + 20*60)
                        setPlayerStorageValue(gid, storage_check, getPlayerGuildId(cid))
                    end
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A arena ja esta ocupada.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nenhum lider da guild "..t[2].." esta online.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif t[1] == "accept" then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if getPlayerStorageValue(cid, storage_accept) > os.time() then
                if getPlayerStorageValue(cid, storage_check) == getGuildId(t[2]) then
                    setGlobalStorageValue(arena_storage, os.time() + 3600)
                    setGlobalStorageValue(guild_accept, getPlayerGuildId(cid))
                    setGlobalStorageValue(guild_invite, getGuildId(t[2]))
                    if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true) > 0 then
                        for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..getPlayerGuildName(cid).."! Para participar diga /war"..city.." go")
                        end
                    end
                    if #getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true) > 0 then
                        for _, pid in pairs(getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true)) do
                            doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..t[2].."! Para participar diga /war"..city.." go")
                        end
                    end
                    addEvent(function()
                        for _, pid in pairs(getPlayersOnline()) do
                            if isInArea(getThingPos(pid), {x = 24351, y = 32074, z = 6}, {x = 24733, y = 32434, z = 6}) or isInArea(getThingPos(pid), {x = 24351, y = 32074, z = 7}, {x = 24733, y = 32434, z = 7}) or isInArea(getThingPos(pid), {x = 24351, y = 32074, z = 8}, {x = 24733, y = 32434, z = 8}) then
                                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi teleportado para o templo porque o tempo de war acabou")
                            end
                        end
                    end, 1000*3600)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_accept, -1)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_invite, -1)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao te invitou para uma war.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild nao foi chamada para nenhuma war.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif t[1] == "go" then
        if getTilePzInfo(getThingPos(cid)) == false then
            doPlayerSendCancel(cid, "Voce precisa estar em uma area protect zone")
            return true
        end
        if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) or getGlobalStorageValue(guild_accept) == getPlayerGuildId(cid) then
            doPlayerSetStorageValue(cid, 888123, os.time() + getGlobalStorageValue(arena_storage))
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce entrou na war!")
            if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) then
                doTeleportThing(cid, time_1_pos)
            else
                doTeleportThing(cid, time_2_pos)
            end
        else
            doPlayerSendCancel(cid, "Sua guild nao esta em war")
        end
    end
    return true
end

 

War anti-entrosa Carlin:

Spoiler

local arena_storage = 454523
local players_storage = 456512
local storage_accept = 151230
local storage_check = 153201
local guild_invite = 542351
local guild_accept = 456121
local time_1_pos = {x = 25362, y = 31735, z = 7}
local time_2_pos = {x = 25018, y = 31830, z = 7}
local city = "carlin"

local function getOnlineGuildMembersByRank(guildId, rank, selectLowerRanks) -- Funcao feita pelo Omega
    if not rank then
        rank = 3
        selectLowerRanks = true
    end
    local list = {}
    for _, pid in pairs(getPlayersOnline()) do
        if getPlayerGuildId(pid) == guildId then
            local playerRank = getPlayerGuildLevel(pid)
            if playerRank == rank or (selectLowerRanks and playerRank <= rank) then
                table.insert(list, pid)
            end
        end
    end
    return list
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendCancel(cid, "Use os parametros corretos.")
        return true
    end
    
    if getPlayerLevel(cid) <= 30 then
        doPlayerSendCancel(cid, "Voce nao tem level suficiente.")
        return true
    end
    
    local t = string.explode(param, ",")
    
    if t[1] == "invite" then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false) > 0 then
                if getGlobalStorageValue(arena_storage) <= os.time() then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce convidou a guild "..t[2].." para uma war em "..city.."!")
                    for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureName(cid).." da guild "..getPlayerGuildName(cid).." chamou sua guild para uma war em "..city.." Para aceitar diga /war"..city.." accept, "..getPlayerGuildName(cid)..".")
                        setPlayerStorageValue(gid, storage_accept, os.time() + 20*60)
                        setPlayerStorageValue(gid, storage_check, getPlayerGuildId(cid))
                    end
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A arena ja esta ocupada.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nenhum lider da guild "..t[2].." esta online.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif t[1] == "accept" then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if getPlayerStorageValue(cid, storage_accept) > os.time() then
                if getPlayerStorageValue(cid, storage_check) == getGuildId(t[2]) then
                    setGlobalStorageValue(arena_storage, os.time() + 3600)
                    setGlobalStorageValue(guild_accept, getPlayerGuildId(cid))
                    setGlobalStorageValue(guild_invite, getGuildId(t[2]))
                    if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true) > 0 then
                        for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..getPlayerGuildName(cid).."! Para participar diga /war"..city.." go")
                        end
                    end
                    if #getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true) > 0 then
                        for _, pid in pairs(getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true)) do
                            doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..t[2].."! Para participar diga /war"..city.." go")
                        end
                    end
                    addEvent(function()
                        for _, pid in pairs(getPlayersOnline()) do
                            if isInArea(getThingPos(pid), {x = 24772, y = 3131584, z = 7}, {x = 25407, y = 32053, z = 7}) then
                                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi teleportado para o templo porque o tempo de war acabou")
                            end
                        end
                    end, 1000*3600)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_accept, -1)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_invite, -1)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao te invitou para uma war.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild nao foi chamada para nenhuma war.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif t[1] == "go" then
        if getTilePzInfo(getThingPos(cid)) == false then
            doPlayerSendCancel(cid, "Voce precisa estar em uma area protect zone")
            return true
        end
        if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) or getGlobalStorageValue(guild_accept) == getPlayerGuildId(cid) then
            doPlayerSetStorageValue(cid, 888123, os.time() + getGlobalStorageValue(arena_storage))
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce entrou na war!")
            if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) then
                doTeleportThing(cid, time_1_pos)
            else
                doTeleportThing(cid, time_2_pos)
            end
        else
            doPlayerSendCancel(cid, "Sua guild nao esta em war")
        end
    end
    return true
end

 

War anti-entrosa Ankrahmun:

Spoiler

local arena_storage = 454415
local players_storage = 456846
local storage_accept = 151742
local storage_check = 153129
local guild_invite = 542916
local guild_accept = 456023
local time_1_pos = {x = 25688, y = 32032, z = 8}
local time_2_pos = {x = 25600, y = 32415, z = 7}
local city = "ankrahmun"

local function getOnlineGuildMembersByRank(guildId, rank, selectLowerRanks) -- Funcao feita pelo Omega
    if not rank then
        rank = 3
        selectLowerRanks = true
    end
    local list = {}
    for _, pid in pairs(getPlayersOnline()) do
        if getPlayerGuildId(pid) == guildId then
            local playerRank = getPlayerGuildLevel(pid)
            if playerRank == rank or (selectLowerRanks and playerRank <= rank) then
                table.insert(list, pid)
            end
        end
    end
    return list
end

function onSay(cid, words, param, channel)
    if param == "" then
        doPlayerSendCancel(cid, "Use os parametros corretos.")
        return true
    end
    
    if getPlayerLevel(cid) <= 30 then
        doPlayerSendCancel(cid, "Voce nao tem level suficiente.")
        return true
    end
    
    local t = string.explode(param, ",")
    
    if t[1] == "invite" then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false) > 0 then
                if getGlobalStorageValue(arena_storage) <= os.time() then
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Voce convidou a guild "..t[2].." para uma war em "..city.."!")
                    for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, false)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_ORANGE, getCreatureName(cid).." da guild "..getPlayerGuildName(cid).." chamou sua guild para uma war em "..city.." Para aceitar diga /war"..city.." accept, "..getPlayerGuildName(cid)..".")
                        setPlayerStorageValue(gid, storage_accept, os.time() + 20*60)
                        setPlayerStorageValue(gid, storage_check, getPlayerGuildId(cid))
                    end
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "A arena ja esta ocupada.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Nenhum lider da guild "..t[2].." esta online.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif t[1] == "accept" then
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendCancel(cid, "Somente liders de guild podem usar esse comando.")
            return true
        end
        if getGuildId(t[2]) and getGuildId(t[2]) ~= getPlayerGuildId(cid) then
            if getPlayerStorageValue(cid, storage_accept) > os.time() then
                if getPlayerStorageValue(cid, storage_check) == getGuildId(t[2]) then
                    setGlobalStorageValue(arena_storage, os.time() + 3600)
                    setGlobalStorageValue(guild_accept, getPlayerGuildId(cid))
                    setGlobalStorageValue(guild_invite, getGuildId(t[2]))
                    if #getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true) > 0 then
                        for _, gid in pairs(getOnlineGuildMembersByRank(getGuildId(t[2]), 3, true)) do
                        doPlayerSendTextMessage(gid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..getPlayerGuildName(cid).."! Para participar diga /war"..city.." go")
                        end
                    end
                    if #getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true) > 0 then
                        for _, pid in pairs(getOnlineGuildMembersByRank(getPlayerGuildId(cid), 3, true)) do
                            doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild entrou em war contra a guild "..t[2].."! Para participar diga /war"..city.." go")
                        end
                    end
                    addEvent(function()
                        for _, pid in pairs(getPlayersOnline()) do
                            if isInArea(getThingPos(pid), {x = 25427, y = 31784, z = 5}, {x = 25879, y = 32503, z = 5}) or isInArea(getThingPos(pid), {x = 25427, y = 31784, z = 6}, {x = 25879, y = 32503, z = 6}) or isInArea(getThingPos(pid), {x = 25427, y = 31784, z = 7}, {x = 25879, y = 32503, z = 7}) or isInArea(getThingPos(pid), {x = 25427, y = 31784, z = 8}, {x = 25879, y = 32503, z = 8}) then
                                doTeleportThing(pid, getTownTemplePosition(getPlayerTown(cid)))
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce foi teleportado para o templo porque o tempo de war acabou")
                            end
                        end
                    end, 1000*3600)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_accept, -1)
                    addEvent(setGlobalStorageValue, 3600*1000, guild_invite, -1)
                else
                    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao te invitou para uma war.")
                end
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sua guild nao foi chamada para nenhuma war.")
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Essa guild nao existe.")
        end
    elseif t[1] == "go" then
        if getTilePzInfo(getThingPos(cid)) == false then
            doPlayerSendCancel(cid, "Voce precisa estar em uma area protect zone")
            return true
        end
        if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) or getGlobalStorageValue(guild_accept) == getPlayerGuildId(cid) then
            doPlayerSetStorageValue(cid, 888123, os.time() + getGlobalStorageValue(arena_storage))
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Voce entrou na war!")
            if getGlobalStorageValue(guild_invite) == getPlayerGuildId(cid) then
                doTeleportThing(cid, time_1_pos)
            else
                doTeleportThing(cid, time_2_pos)
            end
        else
            doPlayerSendCancel(cid, "Sua guild nao esta em war")
        end
    end
    return true
end

 

Créditos: Way20.

 

Compartilhar este post


Link para o post
Compartilhar em outros sites
  • 0
bitoca1995    0
bitoca1995

é a mesma que possuo, nenhuma funciona, mas de qualquer forma obrigado..

caso descobrir como resolve a do chaito, eu agradeço muito...

boa noite...

Compartilhar este post


Link para o post
Compartilhar em outros sites
Visitante
Este tópico está impedido de receber novos posts.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×