Ir para conteúdo

Remover Monstro


Menoxcide

Posts Recomendados

Galera ta td certo nesse script menos a parte pra remove o monstro, olha só:

 

 

local storage = 1755

local emGuerra = 1756

local War = {

fromPos={x=1349, y=1101, z=7, stackpos=253},

toPos={x=1359, y=1111, z=0, stackpos=253},

rewardRoom = {x=518,y=840,z=7,stackpos=1}}

local config = {

empe = {x=55, y=34, z=5},

pre1 = {x=68, y=37, z=6},

pre2 = {x=42, y=37, z=6}

}

local tpId = 1387

local tp = {

pos1 = {x=51, y=28, z=6},

pos2 = {x=59, y=28, z=6}

}

function removeTp(tp)

local t = getTileItemById(tp.pos1, tpId)

if t then

doRemoveItem(t.uid, 1)

doSendMagicEffect(tp.pos1, CONST_ME_POFF)

end

end

function removeTeleport(tps)

local t = getTileItemById(tp.pos2, tpId)

if t then

doRemoveItem(t.uid, 1)

doSendMagicEffect(tp.pos2, CONST_ME_POFF)

end

end

function onSay(cid, words, param)

if param == "open" then

setGlobalStorageValue(emGuerra,1)

doBroadcastMessage("War of Emperium has began!",22)

doSummonCreature("Emperium",config.empe,false)

doSummonCreature("Emperium Guard",config.pre1,false)

doSummonCreature("Emperium Guardian",config.pre2,false)

addEvent(removeTp, 2*1000, tp)

addEvent(removeTeleport, 2*1000, tps)

return true

elseif param == "close" then

for _, pid in ipairs(getPlayersOnline()) do

if isInArea(getPlayerPosition(pid), War.fromPos, War.toPos) then

if getGlobalStorageValue(storage) ~= getPlayerGuildId(pid) then

doTeleportThing(pid, War.rewardRoom, false)

doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE,"Sorry, your guild not win the war!")

else

doPlayerSendTextMessage(pid,MESSAGE_STATUS_CONSOLE_BLUE,"Your guild has domation the castle. Congratulations to help her!")

end

end

end

setGlobalStorageValue(emGuerra,0)

doRemoveCreature(cid, config.empe, 1)

doBroadcastMessage("The war for the castle has ended!",22)

else

return doPlayerSendCancel(cid,"Talk /war open[for begin the wr] or /war close[for end the war]")

end

return true

end

 

 

 

eu nunca usei esse action doRemoveCreature entao nao sei se tem q estar assin msm: (cid, config.empe, 1) ou se esta td errado...ajuda ae plx

Link para o comentário
Compartilhar em outros sites

vish continuo dando o msm erro...vo posta ake pra tu ver o erro

 

[Error - TalkAction Interface]

data/talkactions/scripts/castlewar-talk.lua:onSay

Description:

(luaDoRemoveCreature) Creature not found

> Broadcasted message: "The war for the castle has ended!".

Link para o comentário
Compartilhar em outros sites

Tenta assim, eu modifiquei no script a parte que remove a criatura:

 

 

local storage = 1755
local emGuerra = 1756
local War = {
fromPos={x=1349, y=1101, z=7, stackpos=253},
toPos={x=1359, y=1111, z=0, stackpos=253},
rewardRoom = {x=518,y=840,z=7,stackpos=1}}
local config = {
empe = {x=55, y=34, z=5},
pre1 = {x=68, y=37, z=6},
pre2 = {x=42, y=37, z=6}
}
local tpId = 1387
local tp = {
pos1 = {x=51, y=28, z=6},
pos2 = {x=59, y=28, z=6}
}
function removeTp(tp)
local t = getTileItemById(tp.pos1, tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos1, CONST_ME_POFF)
end
end
function removeTeleport(tps)
local t = getTileItemById(tp.pos2, tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos2, CONST_ME_POFF)
end
end
function onSay(cid, words, param)
if param == "open" then
setGlobalStorageValue(emGuerra,1)
doBroadcastMessage("War of Emperium has began!",22)
doSummonCreature("Emperium",config.empe,false)
doSummonCreature("Emperium Guard",config.pre1,false)
doSummonCreature("Emperium Guardian",config.pre2,false)
addEvent(removeTp, 2*1000, tp)
addEvent(removeTeleport, 2*1000, tps)
return true
elseif param == "close" then
for _, pid in ipairs(getPlayersOnline()) do
if isInArea(getPlayerPosition(pid), War.fromPos, War.toPos) then
if getGlobalStorageValue(storage) ~= getPlayerGuildId(pid) then
doTeleportThing(pid, War.rewardRoom, false)
doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE,"Sorry, your guild not win the war!")
else
doPlayerSendTextMessage(pid,MESSAGE_STATUS_CONSOLE_BLUE,"Your guild has domation the castle. Congratulations to help her!")
end
end
end
setGlobalStorageValue(emGuerra,0)
empecreature = getThingfromPos(config.empe)
if isMonster(empecreature.uid) == TRUE then
doRemoveCreature(config.empe, 1)
end
doBroadcastMessage("The war for the castle has ended!",22)
else
return doPlayerSendCancel(cid,"Talk /war open[for begin the wr] or /war close[for end the war]")
end
return true
end

 

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

Assim é pra funcionar:

 

local storage = 1755
local emGuerra = 1756
local War = {
fromPos={x=1349, y=1101, z=7, stackpos=253},
toPos={x=1359, y=1111, z=0, stackpos=253},
rewardRoom = {x=518,y=840,z=7,stackpos=1}}
local config = {
empe = {x=55, y=34, z=5},
pre1 = {x=68, y=37, z=6},
pre2 = {x=42, y=37, z=6}
}
local tpId = 1387
local tp = {
pos1 = {x=51, y=28, z=6},
pos2 = {x=59, y=28, z=6}
}
function removeTp(tp)
local t = getTileItemById(tp.pos1, tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos1, CONST_ME_POFF)
end
end

function removeTeleport(tps)
local t = getTileItemById(tp.pos2, tpId)
if t then
doRemoveItem(t.uid, 1)
doSendMagicEffect(tp.pos2, CONST_ME_POFF)
end
end

function onSay(cid, words, param)

if param == "open" then
   setGlobalStorageValue(emGuerra,1)
   doBroadcastMessage("War of Emperium has began!",22)
   mid = doSummonCreature("Emperium",config.empe,false)
   doSummonCreature("Emperium Guard",config.pre1,false)
   doSummonCreature("Emperium Guardian",config.pre2,false)
   addEvent(removeTp, 2*1000, tp)
   addEvent(removeTeleport, 2*1000, tps)
   return true
elseif param == "close" then
   for _, pid in ipairs(getPlayersOnline()) do
       if isInArea(getPlayerPosition(pid), War.fromPos, War.toPos) then
           if getGlobalStorageValue(storage) ~= getPlayerGuildId(pid) then
               doTeleportThing(pid, War.rewardRoom, false)
               doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE,"Sorry, your guild not win the war!")
           else
               doPlayerSendTextMessage(pid,MESSAGE_STATUS_CONSOLE_BLUE,"Your guild has domation the castle. Congratulations to help her!")
           end
       end
   end
setGlobalStorageValue(emGuerra,0)
doRemoveCreature(mid)
doBroadcastMessage("The war for the castle has ended!",22)
else
return doPlayerSendCancel(cid,"Talk /war open[for begin the wr] or /war close[for end the war]")
end
return true
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...