I need help correcting this. plz <3
Lua:
local msgs = {" use "}
function doAlertReady(cid, id, movename, n, cd)
if not isCreature(cid) then return true end
local myball = getPlayerSlotItem(cid, 8)
if myball.itemid > 0 and getItemAttribute(myball.uid, cd) == "cd:"..id.."" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(myball.uid).." - "..movename.." (m"..n..") is ready!")
return true
end
local p = getPokeballsInContainer(getPlayerSlotItem(cid, 3).uid)
if not p or #p <= 0 then return true end
for a = 1, #p do
if getItemAttribute(p[a], cd) == "cd:"..id.."" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPokeballName(p[a]).." - "..movename.." (m"..n..") is ready!")
return true
end
end
end
function onSay(cid, words, param, channel)
if param ~= "" then return true end
if string.len(words) > 3 then return true end
if #getCreatureSummons(cid) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need a pokemon to use moves.")
return 0
end
--alterado v1.5
local mypoke = getCreatureSummons(cid)[1]
local item = getPlayerSlotItem(cid, 8)
if getCreatureCondition(cid, CONDITION_EXHAUST) then return true end
if getCreatureName(mypoke) == "Evolution" then return true end
local name = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "poke")
local copy = getItemAttribute(item.uid, "copyName") or ""
if isInArray({"ditto", "shiny ditto"}, copy:lower()) then
return true
end
if getItemAttribute(item.uid, "copyName") then -- ditto system
name = getItemAttribute(item.uid, "copyName")
elseif isMega(mypoke) then --alterado v1.9
name = getPlayerStorageValue(mypoke, storages.isMega)
end
--local name = getCreatureName(mypoke) == "Ditto" and getPlayerStorageValue(mypoke, 1010) or getCreatureName(mypoke)
local it = string.sub(words, 2, 3)
local tablemove = movestable[name]
--------------SMEARGLETABLE
if name == "Smeargle" then
local move1 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch1")
local move2 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch2")
local move3 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch3")
local move4 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch4")
local move5 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch5")
local move6 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch6")
local move7 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch7")
local move8 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch8")
local move9 = getItemAttribute(getPlayerSlotItem(cid, 8).uid, "Sketch9")
local movename1, movecd1, moveforce1, movetype1, movetarget1, movelevel1, movedist1 = string.explode(move1, "|")[1], string.explode(move1, "|")[2], string.explode(move1, "|")[3], string.explode(move1, "|")[4], string.explode(move1, "|")[5], string.explode(move1, "|")[6], string.explode(move1, "|")[7]
local movename2, movecd2, moveforce2, movetype2, movetarget2, movelevel2, movedist2 = string.explode(move2, "|")[1], string.explode(move2, "|")[2], string.explode(move2, "|")[3], string.explode(move2, "|")[4], string.explode(move2, "|")[5], string.explode(move2, "|")[6], string.explode(move2, "|")[7]
local movename3, movecd3, moveforce3, movetype3, movetarget3, movelevel3, movedist3 = string.explode(move3, "|")[1], string.explode(move3, "|")[2], string.explode(move3, "|")[3], string.explode(move3, "|")[4], string.explode(move3, "|")[5], string.explode(move3, "|")[6], string.explode(move3, "|")[7]
local movename4, movecd4, moveforce4, movetype4, movetarget4, movelevel4, movedist4 = string.explode(move4, "|")[1], string.explode(move4, "|")[2], string.explode(move4, "|")[3], string.explode(move4, "|")[4], string.explode(move4, "|")[5], string.explode(move4, "|")[6], string.explode(move4, "|")[7]
local movename5, movecd5, moveforce5, movetype5, movetarget5, movelevel5, movedist5 = string.explode(move5, "|")[1], string.explode(move5, "|")[2], string.explode(move5, "|")[3], string.explode(move5, "|")[4], string.explode(move5, "|")[5], string.explode(move5, "|")[6], string.explode(move5, "|")[7]
local movename6, movecd6, moveforce6, movetype6, movetarget6, movelevel6, movedist6 = string.explode(move6, "|")[1], string.explode(move6, "|")[2], string.explode(move6, "|")[3], string.explode(move6, "|")[4], string.explode(move6, "|")[5], string.explode(move6, "|")[6], string.explode(move6, "|")[7]
local movename7, movecd7, moveforce7, movetype7, movetarget7, movelevel7, movedist7 = string.explode(move7, "|")[1], string.explode(move7, "|")[2], string.explode(move7, "|")[3], string.explode(move7, "|")[4], string.explode(move7, "|")[5], string.explode(move7, "|")[6], string.explode(move7, "|")[7]
local movename8, movecd8, moveforce8, movetype8, movetarget8, movelevel8, movedist8 = string.explode(move8, "|")[1], string.explode(move8, "|")[2], string.explode(move8, "|")[3], string.explode(move8, "|")[4], string.explode(move8, "|")[5], string.explode(move8, "|")[6], string.explode(move8, "|")[7]
local movename9, movecd9, moveforce9, movetype9, movetarget9, movelevel9, movedist9 = string.explode(move9, "|")[1], string.explode(move9, "|")[2], string.explode(move9, "|")[3], string.explode(move9, "|")[4], string.explode(move9, "|")[5], string.explode(move9, "|")[6], string.explode(move9, "|")[7]
local smeargletable = {move1 = {name = movename1, level = tonumber(movelevel1), cd = tonumber(movecd1), dist = tonumber(movedist1), target = tonumber(movetarget1), f = tonumber(moveforce1), t = movetype1},
move2 = {name = movename2, level = tonumber(movelevel2), cd = tonumber(movecd2), dist = tonumber(movedist2), target = tonumber(movetarget2), f = tonumber(moveforce2), t = movetype2},
move3 = {name = movename3, level = tonumber(movelevel3), cd = tonumber(movecd3), dist = tonumber(movedist3), target = tonumber(movetarget3), f = tonumber(moveforce3), t = movetype3},
move4 = {name = movename4, level = tonumber(movelevel4), cd = tonumber(movecd4), dist = tonumber(movedist4), target = tonumber(movetarget4), f = tonumber(moveforce4), t = movetype4},
move5 = {name = movename5, level = tonumber(movelevel5), cd = tonumber(movecd5), dist = tonumber(movedist5), target = tonumber(movetarget5), f = tonumber(moveforce5), t = movetype5},
move6 = {name = movename6, level = tonumber(movelevel6), cd = tonumber(movecd6), dist = tonumber(movedist6), target = tonumber(movetarget6), f = tonumber(moveforce6), t = movetype6},
move7 = {name = movename7, level = tonumber(movelevel7), cd = tonumber(movecd7), dist = tonumber(movedist7), target = tonumber(movetarget7), f = tonumber(moveforce7), t = movetype7},
move8 = {name = movename8, level = tonumber(movelevel8), cd = tonumber(movecd8), dist = tonumber(movedist8), target = tonumber(movetarget8), f = tonumber(moveforce8), t = movetype8},
move9 = {name = movename9, level = tonumber(movelevel9), cd = tonumber(movecd9), dist = tonumber(movedist9), target = tonumber(movetarget9), f = tonumber(moveforce9), t = movetype9},
}
tablemove =smeargletable
end
--------------SMEARGLETABLE
if not tablemove then
doSendMsg(cid, "Este pok�mon n�o tem spell.")
return true
end
local move = tablemove.move1
if getPlayerStorageValue(mypoke, 212123) >= 1 then
cdzin = "cm_move"..it..""
else
cdzin = "move"..it.."" --alterado v1.5
end
if it == "2" then
move = tablemove.move2
elseif it == "3" then
move = tablemove.move3
elseif it == "4" then
move = tablemove.move4
elseif it == "5" then
move = tablemove.move5
elseif it == "6" then
move = tablemove.move6
elseif it == "7" then
move = tablemove.move7
elseif it == "8" then
move = tablemove.move8
elseif it == "9" then
move = tablemove.move9
elseif it == "10" then
move = tablemove.move10
elseif it == "11" then
move = tablemove.move11
elseif it == "12" then
move = tablemove.move12
elseif it == "13" then
move = tablemove.move13
end
local heldy = getItemAttribute(item.uid, "yHeldItem")
if not move or (string.find(move.name, "- ") and not (heldy and string.find(heldy, "MEGA"))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your pokemon doesn't recognize this move.")
return true
end
if not string.find(move.name, "Mega ") then
if getPlayerLevel(cid) < move.level then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need be atleast level "..move.level.." to use this move.")
return true
end
if getPlayerGroupId(cid) < 4 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) > 0 and getCD(getPlayerSlotItem(cid, 8).uid, cdzin) < (move.cd + 2) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have to wait "..getCD(getPlayerSlotItem(cid, 8).uid, cdzin).." seconds to use "..move.name.." again.")
return true
end
if getTileInfo(getThingPos(mypoke)).protection then
doPlayerSendCancel(cid, "Your pokemon cannot use moves while in protection zone.")
return true
end
if getPlayerStorageValue(mypoke, 3894) >= 1 then
return doPlayerSendCancel(cid, "You can't attack because you is with fear") --alterado v1.3
end
end
--alterado v1.6
if (move.name == "Team Slice" or move.name == "Team Claw") and #getCreatureSummons(cid) < 2 then
doPlayerSendCancel(cid, "Your pokemon need be in a team for use this move!")
return true
end
if move.passive and move.passive == "sim" then
return true
end
if move.target == 1 then
if not isCreature(getCreatureTarget(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You don\'t have any targets.")
return 0
end
if getCreatureCondition(getCreatureTarget(cid), CONDITION_INVISIBLE) then
return 0
end
if getCreatureHealth(getCreatureTarget(cid)) <= 0 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Your have already defeated your target.")
return 0
end
if not isCreature(getCreatureSummons(cid)[1]) then
return true
end
if getDistanceBetween(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid))) > move.dist then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Get closer to the target to use this move.")
return 0
end
if not isSightClear(getThingPos(getCreatureSummons(cid)[1]), getThingPos(getCreatureTarget(cid)), false) then
return 0
end
end
local newid = 0
if isSleeping(mypoke) or isSilence(mypoke) then --alterado v1.5
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry you can't do that right now.")
return 0
else
newid = setCD(getPlayerSlotItem(cid, 8).uid, cdzin, move.cd)
end
if string.find(move.name, "- ") then
doCreatureSay(cid, ""..getPokeName(mypoke)..", MEGA EVOLUCIONA!!", TALKTYPE_ORANGE_1)
else
doCreatureSay(cid, ""..getPokeName(mypoke)..", "..msgs[math.random(#msgs)]..""..move.name.."!", TALKTYPE_ORANGE_1)
end
local summons = getCreatureSummons(cid) --alterado v1.6
--addEvent(doAlertReady, move.cd * 1000, cid, newid, move.name, it, cdzin)
for i = 2, #summons do
if isCreature(summons[i]) then
docastspell(summons[i], move.name) --alterado v1.6
end
end
docastspell(mypoke, move.name)
doCreatureAddCondition(cid, playerexhaust)
if useKpdoDlls then
doUpdateCooldowns(cid)
end
return 0
end