Estava em outro fórum quando vi um request de exiva por talkactions... Então resolvi fazê-lo
Espero que gostem...
@pekeboi
CRÉDITOS 100% PARA MIM!
--
Aqui está:
-- Ignore all the errors on Console Screen. -- function onSay(cid, words, param) msg = {eastl="is to the east.", westl="is to the west.", northl="is to the north.", southl="is to the south.", northel="is to the north-east.", northwl="is to the north-west.", southel="is to the south-east.", southwl="is to the south-west.", easta="is on a higher level to the east.", westa="is on a higher level to the west.", northa="is on a higher level to the north.", southa="is on a higher level to the south.", northea="is on a higher level to the north-east.", northwa="is on a higher level to the north-west.", southea="is on a higher level to the south-east.", southwa="is on a higher level to the south-west.", eastu="is on a lower level to the east.", westu="is on a lower level to the west.", northu="is on a lower level to the north.", southu="is on a lower level to the south.", northeu="is on a lower level to the north-east.", northwu="is on a lower level to the north-west.", southeu="is on a lower level to the south-east.", southwu="is on a lower level to the south-west.", above="is above you.", below="is below you.", near="is standing next to you."} neardistance = 2 -- How many sqms to be near? manawaste = 20 -- How many mana does it cost? soulwaste = 0 -- How many soul does it cost? np = 0 -- Dont change near = false -- Dont change ppos = getPlayerPosition(cid) if getPlayerByName(param) ~= 0 then targ = getPlayerByName(param) targpos = getPlayerPosition(targ) -- Checking Z -- if targpos.z == ppos.z then above = false under = false elseif targpos.z > ppos.z then above = false under = true elseif targpos.z < ppos.z then above = true under = false else doPlayerSendCancel(cid,'Something is bugged. Please report to a GM.') end -- End Checking Z -- -- Checking X,Y -- if targpos.x > ppos.x+neardistance then if targpos.y > ppos.y+neardistance then np = south-east elseif targpos.y < ppos.y-neardistance then np = north-east else np = east end elseif targpos.x < ppos.x-neardistance then if targpos.y > ppos.y+neardistance then np = south-west elseif targpos.y < ppos.y-neardistance then np = north-west else np = west end else if targpos.y > ppos.y+neardistance then np = south elseif targpos.y < ppos.y-neardistance then np = north else near = true end end -- End Checking X,Y -- -- Check and Send Msgs -- if near == true then if above == true then send = ""..param.." "..msg.above.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.below.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.near.."" doPlayerSendTextMessage(cid,22,send) end elseif near == false then if np == north then if above == true then send = ""..param.." "..msg.northa.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.northu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.northl.."" doPlayerSendTextMessage(cid,22,send) end elseif np == south then if above == true then send = ""..param.." "..msg.southa.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.southu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.southl.."" doPlayerSendTextMessage(cid,22,send) end elseif np == east then if above == true then send = ""..param.." "..msg.easta.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.eastu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.eastl.."" doPlayerSendTextMessage(cid,22,send) end elseif np == west then if above == true then send = ""..param.." "..msg.westa.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.westu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.westl.."" doPlayerSendTextMessage(cid,22,send) end elseif np == north-east then if above == true then send = ""..param.." "..msg.northea.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.northeu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.northel.."" doPlayerSendTextMessage(cid,22,send) end elseif np == north-west then if above == true then send = ""..param.." "..msg.northwa.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.northwu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.northwl.."" doPlayerSendTextMessage(cid,22,send) end elseif np == south-east then if above == true then send = ""..param.." "..msg.southwa.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.southwu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.southwl.."" doPlayerSendTextMessage(cid,22,send) end elseif np == south-west then if above == true then send = ""..param.." "..msg.southwa.."" doPlayerSendTextMessage(cid,22,send) elseif under == true then send = ""..param.." "..msg.southwu.."" doPlayerSendTextMessage(cid,22,send) else send = ""..param.." "..msg.southwl.."" doPlayerSendTextMessage(cid,22,send) end else doPlayerSendCancel(cid,'Something is bugged. Please report to a GM.') end end doPlayerAddMana(cid,-manawaste) doPlayerAddSoul(cid,-soulwaste) doSendMagicEffect(ppos,12) -- End Checking X,Y -- else doPlayerSendCancel(cid,'A player with this name is not online.') doSendMagicEffect(ppos,2) end end