elseif isSummon(thing.uid) and not isPlayer(thing.uid) then --summons
if getCreatureMaster(thing.uid) == cid then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a "..string.lower(getCreatureName(thing.uid))..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a "..string.lower(getCreatureName(thing.uid))..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
end
return false
end
return true
end
Se for possivel precisar
Meu data/lib/some functions.lua
function getPlayerDexList(cid)
n = 0
if not isCreature(cid) then return n end
for a,b in pairs(pokes) do
if b.dex then
if tonumber(getPlayerStorageValue(cid, b.dex)) >= 1 then
n = n + 1
end
end
end
return n
end
function getPlayerCatchList(cid)
n = 0
if not isCreature(cid) then return n end
for a,b in pairs(pokes) do
if b.catch then
if tonumber(getPlayerStorageValue(cid, b.catch.sto)) >= 1 then
n = n + 1
end
end
end
return n
end
local function getPlayerInArea(from, to)
local inarea = {}
for x=from.x, to.x do
for y=from.y, to.y do
for z=from.z, to.z do
local p = getTopCreature({x=x, y=y, z=z}).uid
if p ~= 0 and isPlayer(p) then
table.insert(inarea, p)
end
end
end
end
return inarea
end
function getPlayerInArea(fromPos, toPos) -- by jhon992
local online = getPlayersOnline()
local players = {}
for i=1, #online do
if isInArea(getPlayerPosition(online), fromPos, toPos) then
players[#players+1] = online
end
end
return players
end
function getMonstersInArea(from, to)
local inarea = {}
for x=from.x, to.x do
for y=from.y, to.y do
for z=from.z, to.z do
local p = getTopCreature({x=x, y=y, z=z}).uid
if p ~= 0 and isMonster(p) then
if (isSummon(p) and not isPlayer(getCreatureMaster(p))) or not isSummon(p) then
if isInArray({"Aerodactyl", "Kabuto", "Kabutops", "Omanyte", "Omastar"}, name) then
return true
end
return false
end
function isMegaPokemon(name)
if name == nil then return false end
if isInArray({"Mega Alakazam", "Mega Blastoise", "Mega Charizard", "Mega Blaziken", "Mega Lucario", "Mega Gengar"}, name) then
return true
end
return false
end
function sendMsgToPlayer(cid, tpw, msg) --alterado v1.7 \/\/\/
if not isCreature(cid) or not tpw or not msg then return true end
doPlayerSendTextMessage(cid, tpw, msg)
end
function getPlayerDesc(cid, thing, TV)
if (not isCreature(cid) or not isCreature(thing)) and not TV then return "" end
local pos = getThingPos(thing)
local ocup = youAre[getPlayerGroupId(thing)]
local rank = (getPlayerStorageValue(thing, 86228) <= 0) and "a Pokemon Trainer" or lookClans[getPlayerStorageValue(thing, 86228)][getPlayerStorageValue(thing, 862281)]
local name = thing == cid and "yourself" or getCreatureName(thing)
local art = thing == cid and "You are" or (getPlayerSex(thing) == 0 and "She is" or "He is")
local str = {}
table.insert(str, "You see "..name..". "..art.." ")
if youAre[getPlayerGroupId(thing)] then
table.insert(str, (ocup).." and "..rank.." from ".. getTownName(getPlayerTown(thing))..".")
else
table.insert(str, (rank).." from ".. getTownName(getPlayerTown(thing))..".")
end
if getPlayerGuildId(thing) > 0 then
table.insert(str, " "..art.." "..getPlayerGuildRank(thing).." from the "..getPlayerGuildName(thing)..".")
end
if not getPlayerStorageValue(thing, 89051) then
setPlayerStorageValue(thing, 89051, 0)
end
if not getPlayerStorageValue(thing, 89052) then
setPlayerStorageValue(thing, 89052, 0)
end
if getPlayerStorageValue(thing, 89051) and getPlayerStorageValue(thing, 89051) >= 0 then
if isInArray({11827, 11830, 11833, 11836, 11738, 11741, 11744, 11747}, ball) then
return true
end
return false
end
function doRemoveTile(pos)-- Script by mock
pos.stackpos = 0
local sqm = getTileThingByPos(pos)
doRemoveItem(sqm.uid,1)
end
function doCreateTile(id,pos) -- By mock
doAreaCombatHealth(0,0,pos,0,0,0,CONST_ME_NONE)
doCreateItem(id,1,pos)
end
function hasSqm(pos)
local f = getTileThingByPos(pos)
if f.itemid ~= 0 and f.itemid ~= 1 then
return true
end
return false
end
function getPosDirs(p, dir) -- By MatheusMkalo
return dir == 1 and {x=p.x-1, y=p.y, z=p.z} or dir == 2 and {x=p.x-1, y=p.y+1, z=p.z} or dir == 3 and {x=p.x, y=p.y+1, z=p.z} or dir == 4 and {x=p.x+1, y=p.y+1, z=p.z} or dir == 5 and {x=p.x+1, y=p.y, z=p.z} or dir == 6 and {x=p.x+1, y=p.y-1, z=p.z} or dir == 7 and {x=p.x, y=p.y-1, z=p.z} or dir == 8 and {x=p.x-1, y=p.y-1, z=p.z}
end
function canWalkOnPos(pos, creature, pz, water, sqm, proj)
if not pos then return false end
if not pos.x then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid <= 1 and sqm then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 919 then return false end
if isInArray({4820, 4821, 4822, 4823, 4824, 4825}, getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false end
local n = not proj and 3 or 2 --alterado v1.6
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and i ~= 253 and not isCreature(tile.uid) then --edited
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
function canWalkOnPos2(pos, creature, pz, water, sqm, proj) --alterado v1.6
if not pos then return false end
if not pos.x then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid <= 1 and sqm then return false end
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 919 then return false end
if isInArray({4820, 4821, 4822, 4823, 4824, 4825}, getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false end
--[[local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i --edited pra retirar um bug.. ;x
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and i ~= 253 and not isCreature(tile.uid) then --edited
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end ]]
return true
end
function getFreeTile(pos, cid)
if canWalkOnPos(pos, true, false, true, true, false) then
return pos
end
local positions = {}
for a = 0, 7 do
if canWalkOnPos(getPosByDir(pos, a), true, false, true, true, false) then
table.insert(positions, pos)
end
end
if #positions >= 1 then
if isCreature(cid) then
local range = 1000
local ret = getThingPos(cid)
for b = 1, #positions do
if getDistanceBetween(getThingPos(cid), positions) < range then
ret = positions
range = getDistanceBetween(getThingPos(cid), positions)
end
end
return ret
else
return positions[math.random(#positions)]
end
end
return getThingPos(cid)
end
function isWalkable(pos, creature, proj, pz, water)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if isWater(getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid) and water then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
function isPlayerSummon(cid, uid)
if getCreatureMaster(uid) == cid then
return TRUE
end
return FALSE
end
function isSummon(sid)
if not isCreature(sid) then return false end
--
if isPlayer(sid) then
return false
end
if isPlayer(getCreatureMaster(sid)) then
return true
end
return false
end
function getItemsInContainerById(container, itemid) -- Function By Kydrai
local items = {}
if isContainer(container) and getContainerSize(container) > 0 then
for slot=0, (getContainerSize(container)-1) do
local item = getContainerItem(container, slot)
if isContainer(item.uid) then
local itemsbag = getItemsInContainerById(item.uid, itemid)
for i=0, #itemsbag do
table.insert(items, itemsbag)
end
else
if itemid == item.itemid then
table.insert(items, item.uid)
end
end
end
end
return items
end
function getPokeballsInContainer(container) -- Function By Kydrai
if not isContainer(container) then return {} end
local items = {}
if isContainer(container) and getContainerSize(container) > 0 then
for slot=0, (getContainerSize(container)-1) do
local item = getContainerItem(container, slot)
if isContainer(item.uid) then
local itemsbag = getPokeballsInContainer(item.uid)
for i=0, #itemsbag do
table.insert(items, itemsbag)
end
elseif isPokeball(item.itemid) then
table.insert(items, item.uid)
end
end
end
return items
end
function getItensUniquesInContainer(container) --alterado v1.6
if not isContainer(container) then return {} end
local items = {}
if isContainer(container) and getContainerSize(container) > 0 then
for slot=0, (getContainerSize(container)-1) do
local item = getContainerItem(container, slot)
if isContainer(item.uid) then
local itemsbag = getItensUniquesInContainer(item.uid)
for i=0, #itemsbag do
table.insert(items, itemsbag)
end
elseif getItemAttribute(item.uid, "unique") then
table.insert(items, item)
end
end
end
return items
end
function hasSpaceInContainer(container) --alterado v1.6
if not isContainer(container) then return false end
if getContainerSize(container) < getContainerCap(container) then return true end
Pergunta
Caktchup 9
Bom tou testando meu servidor eu dava look não aparecia nada fui ver dando erro
Link para o comentário
Compartilhar em outros sites
9 respostass a esta questão
Posts Recomendados