Ir para conteúdo
  • 0
lks93

Programação [PEDIDO] ajuda com script de guild house

Pergunta

lks93    1
lks93

Antes de fazer a sua pergunta, tenha certeza de ter lido as regras da seção e o guia abaixo:

https://forums.otserv.com.br/index.php?/forums/topic/168583-regras-da-seção/

https://forums.otserv.com.br/index.php?/forums/topic/165121-como-fazer-uma-pergunta-ou-o-grande-guia-do-usuário-com-dúvidas/

Descreva em algumas palavras a base utilizada. (Nome do servidor / Nome do cliente / Nome do website / etc.).

Ex: The Forgotten Server 1.3, Versão: 10.98.

Base:

OTServBR-Global, Versão: 12.40.

Qual é a sua pergunta?

Gostaria de ajuda para transcrever este script.

 em determinada hora a Guil House será liberada para ser dominada por qualquer Guild

 

Você tem o código disponível? Se tiver poste-o na caixa de código que está dentro do spoiler abaixo:

Spoiler

--alavanca para o sistema de guerra de gh

function onUse(cid, item, frompos, item2, topos)

if item.uid == 7375 then
local gh = 1

if item.itemid == 9825 then

local isGuard = getCreatureByName('Dol Elite Guard')

if isGuard ~= nil then
doPlayerSendTextMessage(cid,22,"Vocês tem que matar os guardas primeiro.")
return true
end

local guild_id = getPlayerGuildId(cid)

if guild_id > 0 then
if getGhOwner(gh) ~= guild_id then

local hora = tonumber(os.date("%H"))

if hora < 14 or hora > 21 then
doPlayerSendTextMessage(cid,22,"A Guild House só pode ser invadida entre as 14 e 22 horas.")
return true
end

local world_id = getConfigValue('worldId')

db.executeQuery("UPDATE `guilds` set `gh` = 0 WHERE `gh` = "..gh.." AND `world_id` = "..world_id..";")
db.executeQuery("UPDATE `guilds` set `gh` = "..gh.." WHERE `id` = "..guild_id..";")
updateGhOwner(1)

--expulsa todos da GH

local x_start = 1238
local x_end = 1274
local y_start = 689
local y_end = 718
local z_start = 6
local z_end = 7

local x = x_start
local y = y_start
local z = z_start

while z <= z_end do
while y <= y_end do
while x <= x_end do
local verificaPos = {x = x , y = y, z = z, stackpos = 253}
verifica = getThingfromPos(verificaPos,false)

if isCreature(verifica.uid) == true then
if verifica.uid < 1000000000 then
if getPlayerGuildId(verifica.uid) ~= guild_id then
local xr = math.random(1258,1265)
local yr = math.random(749,755)
local tp = {x=xr,y=yr,z=7}
doTeleportThing(verifica.uid,tp)
print('player tep: '..getPlayerName(verifica.uid))
end
end
end
x=x+1
end
x = x_start
y=y+1
end
z=z+1
end

-- Limpa todas as casas
local house_start = 570
local house_end = 584

local hid = house_start

while hid <= house_end do
setHouseOwner(hid, 0, true)
hid=hid+1
end

doTransformItem(item.uid,item.itemid+1)
doBroadcastMessage("A guild "..getPlayerGuildName(cid).." acaba de dominar a Guild House de Dol\'Guldur!")
return true
else
doPlayerSendTextMessage(cid,22,"Você já domina esta GH.")
--print('mesma guildc')
return true
end
else
doPlayerSendTextMessage(cid,22,"Você precisa ter uma guild para dominar a GH.")
--print('sem guild')
return true
end

return true

elseif item.itemid == 9826 then
--doTransformItem(item.uid,item.itemid-1)

if getPlayerAccess(cid) <= 2 then
doPlayerSendTextMessage(cid,22,"Esta GH já foi invadida hoje, tente novamente amanhã.")
else
doTransformItem(item.uid,item.itemid-1)
end
return true
end
end

return true

end

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, anexe-a dentro do spoiler abaixo:

Spoiler

 

 

Compartilhar este post


Link para o post

0 respostass a esta questão

Recommended Posts

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

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.

×