megachock
Member
- Joined
- Mar 12, 2009
- Messages
- 115
- Reaction score
- 7
Well i made this script, but it was soo big and not simplified, so i tried to make a new one, but doRemoveItem dont works ... Im a noob scripter jaja
Old
New:
Old
Code:
function onDeath(cid, corpse, killer)
local M ={
["Water Poliwrath"] = {Pos1 = {x=1212, y=1592, z=3}, Pos2 = {x=1211, y=1592, z=3}, Pos3 = {x=1210, y=1592, z=3}, Pos4 = {x=1209, y=1592, z=3}, id = 1544, time = 10},
}
local x = M[getCreatureName(cid)]
function criar()
local parede1 = getTileItemById(x.Pos1, x.id)
local parede2 = getTileItemById(x.Pos2, x.id)
local parede3 = getTileItemById(x.Pos3, x.id)
local parede4 = getTileItemById(x.Pos4, x.id)
doCreateItem(x.id, 1, x.Pos1)
doCreateItem(x.id, 1, x.Pos2)
doCreateItem(x.id, 1, x.Pos3)
doCreateItem(x.id, 1, x.Pos4)
end
if x then
local parede1 = getTileItemById(x.Pos1, x.id)
local parede2 = getTileItemById(x.Pos2, x.id)
local parede3 = getTileItemById(x.Pos3, x.id)
local parede4 = getTileItemById(x.Pos4, x.id)
if parede1 and parede2 and parede3 and parede4 then
doRemoveItem(parede1.uid, 1)
doRemoveItem(parede2.uid, 1)
doRemoveItem(parede3.uid, 1)
doRemoveItem(parede4.uid, 1)
doCreatureSay(cid, "The wall will appears in "..x.time.." seconds.", TALKTYPE_ORANGE_1)
addEvent(criar, x.time*1000)
end
end
return TRUE
end
New:
Code:
local M ={
["Water Poliwrath"] = {Pos = {
{x=1212, y=1592, z=3},
{x=1211, y=1592, z=3},
{x=1210, y=1592, z=3},
{x=1209, y=1592, z=3},
},
id = 1544,
time = 10,
},
}
function onDeath(cid, corpse, killer)
local x = M[getCreatureName(cid)]
function criar()
for a = 1, #x.Pos do
local parede = getTileItemById(x.Pos[a], x.id)
doCreateItem(x.id, 1, x.Pos[a])
end
end
local wall = getTileItemById(x.Pos[a], x.id).uid
if x then
if wall then
doRemoveItem(wall)
doCreatureSay(cid, "The wall will appears in "..x.time.." seconds.", TALKTYPE_ORANGE_1)
addEvent(criar, x.time*1000)
end
end
return TRUE
end
end
Last edited: