Ir para conteúdo
  • 0

[Action] Dúvida Sobre Pokeball System


lais16gatinha

Pergunta

Preciso da ajuda de vocês, sou mapper e não entendo muito de script, principalmente de actions e npcs.

Estou criando um ot de Pokemon (quase pronto só falta actions) mas não consigo colocar Pokeball system, alguém poderia me explicar? Eu peguei a do Nahruto, que o DevilMoon postou aqui no Xtibia. Eu faço tudo o que pede, coloco o do começo na functions.lua (lá ta tudo certo eu acho, não aparece erro na hora de ligar o server) mas da erro na action, e eu não entendi muito bem o 'criar pasta e colocar o código abaixo' do DevilMoon, como assim criar pasta? E como eu colo isso na pasta?

Eu estava pegando um arquivo lua da pasta, editando o nome e editando o que tinha dentro, mas não se se ta certo.

Se não entenderam minha dúvida, façam uma pergunta específica que vou estar olhando o tópico em alguns dias.

(Vejam o tópico do DevilMoon aqui: http://www.xtibia.com/forum/topic/132061-action-pokeball-system/ )

 

 

Obs: Meu server é Slayer Yurots 8.42

 

Eu já tentei postar uma pergunta lá, mas não aparece de jeito nenhum :S

 

 

Obrigada '-'

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

cara tu falo que teu ot , nao tem o Global Functions , nem a pasta Functions né?

 

vai em Data>Lib>Functions.lua ve se tem esta pasta , se nao tiver crie e coloque isto dentro!!

 

 

 

function doPlayerGiveItem(cid, itemid, amount, subType)
       local item = 0
       if(isItemStackable(itemid) == TRUE) then
               item = doCreateItemEx(itemid, amount)
               if(doPlayerAddItemEx(cid, item) ~= RETURNVALUE_NOERROR) then
                       return LUA_ERROR
               end
       else
               for i = 1, amount do
                       item = doCreateItemEx(itemid, subType)
                       if(doPlayerAddItemEx(cid, item) ~= RETURNVALUE_NOERROR) then
                               return LUA_ERROR
                       end
               end
       end
       return LUA_NO_ERROR
end

function doPlayerTakeItem(cid, itemid, amount)
       if(getPlayerItemCount(cid, itemid) >= amount) then
               if(doPlayerRemoveItem(cid, itemid, amount) == TRUE) then
                       return LUA_NO_ERROR
               end
       end
       return LUA_ERROR
end

function doPlayerBuyItem(cid, itemid, count, cost, charges)
       if(doPlayerRemoveMoney(cid, cost) == TRUE) then
               return doPlayerGiveItem(cid, itemid, count, charges)
       end
       return LUA_ERROR
end

function doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
       if(doPlayerRemoveMoney(cid, cost) == TRUE) then
               for i = 1, count do
                       local container = doCreateItemEx(containerid, 1)
                       for x = 1, getContainerCapById(containerid) do
                               doAddContainerItem(container, itemid, charges)
                       end
                       doPlayerAddItemEx(cid, container)
               end
               return LUA_NO_ERROR
       end
       return LUA_ERROR
end

function doPlayerSellItem(cid, itemid, count, cost)
       if(doPlayerTakeItem(cid, itemid, count) == LUA_NO_ERROR) then
               if(doPlayerAddMoney(cid, cost) ~= TRUE) then
                       error('Could not add money to ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp)')
               end
               return LUA_NO_ERROR
       end
       return LUA_ERROR
end

function isInRange(pos, fromPos, toPos)
       return (pos.x >= fromPos.x and pos.y >= fromPos.y and pos.z >= fromPos.z and pos.x <= toPos.x and pos.y <= toPos.y and pos.z <= toPos.z) and TRUE or FALSE
end

function isPremium(cid)
       return (isPlayer(cid) == TRUE and (getPlayerPremiumDays(cid) > 0 or getConfigInfo('freePremium') == "yes")) and TRUE or FALSE
end

function getMonthDayEnding(day)
       if day == "01" or day == "21" or day == "31" then
               return "st"
       elseif day == "02" or day == "22" then
               return "nd"
       elseif day == "03" or day == "23" then
               return "rd"
       else
               return "th"
       end
end

function getMonthString(m)
       return os.date("%B", os.time{year = 1970, month = m, day = 1})
end

function getArticle(str)
       return str:find("[AaEeIiOoUuYy]") == 1 and "an" or "a"
end

function isNumber(str)
       return tonumber(str) ~= nil and TRUE or FALSE
end

function getDistanceBetween(firstPosition, secondPosition)
       local xDif = math.abs(firstPosition.x - secondPosition.x)
       local yDif = math.abs(firstPosition.y - secondPosition.y)

       local posDif = math.max(xDif, yDif)
       if(firstPosition.z ~= secondPosition.z) then
               posDif = posDif + 9 + 6
       end
       return posDif
end

function doPlayerAddAddons(cid, addon)
       for i = 0, table.maxn(maleOutfits) do
               doPlayerAddOutfit(cid, maleOutfits[i], addon)
       end

       for i = 0, table.maxn(femaleOutfits) do
               doPlayerAddOutfit(cid, femaleOutfits[i], addon)
       end
end

function isSorcerer(cid)
       if(isPlayer(cid) == FALSE) then
               debugPrint("isSorcerer: Player not found.")
               return false
       end

       return (isInArray({1,5,9}, getPlayerVocation(cid)) == TRUE)
end

function isDruid(cid)
       if(isPlayer(cid) == FALSE) then
               debugPrint("isDruid: Player not found.")
               return false
       end

       return (isInArray({2,6,10}, getPlayerVocation(cid)) == TRUE)
end

function isPaladin(cid)
       if(isPlayer(cid) == FALSE) then
               debugPrint("isPaladin: Player not found.")
               return false
       end

       return (isInArray({3,7,11}, getPlayerVocation(cid)) == TRUE)
end

function isKnight(cid)
       if(isPlayer(cid) == FALSE) then
               debugPrint("isKnight: Player not found.")
               return false
       end

       return (isInArray({4,8,12}, getPlayerVocation(cid)) == TRUE)
end

function isRookie(cid)
       if(isPlayer(cid) == FALSE) then
               debugPrint("isRookie: Player not found.")
               return false
       end

       return (isInArray({0}, getPlayerVocation(cid)) == TRUE)
end

function getDirectionTo(pos1, pos2)
       local dir = NORTH
       if(pos1.x > pos2.x) then
               dir = WEST
               if(pos1.y > pos2.y) then
                       dir = NORTHWEST
               elseif(pos1.y < pos2.y) then
                       dir = SOUTHWEST
               end
       elseif(pos1.x < pos2.x) then
               dir = EAST
               if(pos1.y > pos2.y) then
                       dir = NORTHEAST
               elseif(pos1.y < pos2.y) then
                       dir = SOUTHEAST
               end
       else
               if(pos1.y > pos2.y) then
                       dir = NORTH
               elseif(pos1.y < pos2.y) then
                       dir = SOUTH
               end
       end
       return dir
end

function getPlayerLookPos(cid)
       return getPosByDir(getThingPos(cid), getPlayerLookDir(cid))
end

function getPosByDir(fromPosition, direction, size)
       local n = size or 1

       local pos = fromPosition
       if(direction == NORTH) then
               pos.y = pos.y - n
       elseif(direction == SOUTH) then
               pos.y = pos.y + n
       elseif(direction == WEST) then
               pos.x = pos.x - n
       elseif(direction == EAST) then
               pos.x = pos.x + n
       elseif(direction == NORTHWEST) then
               pos.y = pos.y - n
               pos.x = pos.x - n
       elseif(direction == NORTHEAST) then
               pos.y = pos.y - n
               pos.x = pos.x + n
       elseif(direction == SOUTHWEST) then
               pos.y = pos.y + n
               pos.x = pos.x - n
       elseif(direction == SOUTHEAST) then
               pos.y = pos.y + n
               pos.x = pos.x + n
       end

       return pos
end

function getPlayerMoney(cid)
       return ((getPlayerItemCount(cid, ITEM_CRYSTAL_COIN) * 10000) + (getPlayerItemCount(cid, ITEM_PLATINUM_COIN) * 100) + getPlayerItemCount(cid, ITEM_GOLD_COIN))
end

function doPlayerWithdrawAllMoney(cid)
       return doPlayerWithdrawMoney(cid, getPlayerBalance(cid))
end

function doPlayerDepositAllMoney(cid)
       return doPlayerDepositMoney(cid, getPlayerMoney(cid))
end

function doPlayerTransferAllMoneyTo(cid, target)
       return doPlayerTransferMoneyTo(cid, target, getPlayerBalance(cid))
end

function playerExists(name)
       return getPlayerGUIDByName(name) ~= 0
end

function getTibiaTime()
       local minutes = getWorldTime()
       local hours = 0
       while (minutes > 60) do
               hours = hours + 1
               minutes = minutes - 60
       end

       return {hours = hours, minutes = minutes}
end

function doWriteLogFile(file, text)
       local file = io.open(file, "a+")
       file:write("[" .. os.date("%d/%m/%Y  %H:%M:%S") .. "] " .. text .. "\n")
       file:close()
end

function isInArea(pos, fromPos, toPos)
       if(pos.x >= fromPos.x and pos.x <= toPos.x) then
               if(pos.y >= fromPos.y and pos.y <= toPos.y) then
                       if(pos.z >= fromPos.z and pos.z <= toPos.z) then
                               return TRUE
                       end
               end
       end

       return FALSE
end

function getExperienceForLevel(lv)
       lv = lv - 1
       return ((50 * lv * lv * lv) - (150 * lv * lv) + (400 * lv)) / 3
end

function doMutePlayer(cid, time)
       local condition = createConditionObject(CONDITION_MUTED)
       setConditionParam(condition, CONDITION_PARAM_TICKS, time * 1000)
       return doAddCondition(cid, condition)
end

function getPlayerVocationName(cid)
       return getVocationInfo(getPlayerVocation(cid)).name
end

function getPromotedVocation(vid)
       return getVocationInfo(vid).promotedVocation
end

function doPlayerRemovePremiumDays(cid, days)
       return doPlayerAddPremiumDays(cid, -days)
end

function getPlayerMasterPos(cid)
       return getTownTemplePosition(getPlayerTown(cid))
end

function getItemNameById(itemid)
       return getItemDescriptionsById(itemid).name
end

function getItemPluralNameById(itemid)
       return getItemDescriptionsById(itemid).plural
end

function getItemArticleById(itemid)
       return getItemDescriptionsById(itemid).article
end

function getItemName(uid)
       return getItemDescriptions(uid).name
end

function getItemPluralName(uid)
       return getItemDescriptions(uid).plural
end

function getItemArticle(uid)
       return getItemDescriptions(uid).article
end

function getItemText(uid)
       return getItemDescriptions(uid).text
end

function getItemWriter(uid)
       return getItemDescriptions(uid).writer
end

function getItemDate(uid)
       return getItemDescriptions(uid).date
end

function getTilePzInfo(pos)
       return getTileInfo(pos).protection and TRUE or FALSE
end

function getTileZoneInfo(pos)
       local tmp = getTileInfo(pos)
       if(tmp.pvp) then
               return 2
       end

       if(tmp.nopvp) then
               return 1
       end

       return 0
end

function debugPrint(text)
       return io.stdout:write(text)
end

function doShutdown()
       return doSetGameState(GAMESTATE_SHUTDOWN)
end

function doSummonCreature(name, pos)
       local cid = doCreateMonster(name, pos)
       if(cid ~= LUA_ERROR) then
               return cid
       end

       cid = doCreateNpc(name, pos)
       return cid
end

function getOnlinePlayers()
       local tmp = getPlayersOnline()
       local players = {}
       for i, cid in ipairs(tmp) do
               table.insert(players, getCreatureName(cid))
       end

       return players
end

function getPlayerByName(name)
       local cid = getCreatureByName(name)
       return isPlayer(cid) == TRUE and cid or nil
end

function getPlayerFrags(cid)
       return math.ceil((getPlayerRedSkullTicks(cid) / getConfigInfo('timeToDecreaseFrags')) + 1)
end

function getPartyLeader(cid)
       local party = getPartyMembers(cid)
       if(type(party) ~= 'table') then
               return 0
       end

       return party[1]
end

function isInParty(cid)
       return type(getPartyMembers(cid)) == 'table' and TRUE or FALSE
end

function isPrivateChannel(channelId)
       for i = CHANNEL_GUILD, CHANNEL_HELP do
               if(channelId == i) then
                       return FALSE
               end
       end

       return TRUE
end

function doConvertIntegerToIp(int, mask)
       local b4 = bit.urshift(bit.uband(int, 4278190080), 24)
       local b3 = bit.urshift(bit.uband(int, 16711680), 16)
       local b2 = bit.urshift(bit.uband(int, 65280), 8)
       local b1 = bit.urshift(bit.uband(int, 255), 0)
       if(mask ~= nil) then
               local m4 = bit.urshift(bit.uband(mask,  4278190080), 24)
               local m3 = bit.urshift(bit.uband(mask,  16711680), 16)
               local m2 = bit.urshift(bit.uband(mask,  65280), 8)
               local m1 = bit.urshift(bit.uband(mask,  255), 0)
               if((m1 == 255 or m1 == 0) and (m2 == 255 or m2 == 0) and (m3 == 255 or m3 == 0) and (m4 == 255 or m4 == 0)) then
                       if m1 == 0 then b1 = "x" end
                       if m2 == 0 then b2 = "x" end
                       if m3 == 0 then b3 = "x" end
                       if m4 == 0 then b4 = "x" end
               elseif(m1 ~= 255 or m2 ~= 255 or m3 ~= 255 or m4 ~= 255) then
                       return b1 .. "." .. b2 .. "." .. b3 .. "." .. b4 .. " : " .. m1 .. "." .. m2 .. "." .. m3 .. "." .. m4
               end
       end

       return b1 .. "." .. b2 .. "." .. b3 .. "." .. b4
end

function doConvertIpToInteger(str)
       local maskindex = str:find(":")
       if(maskindex == nil) then
               local ipint = 0
               local maskint = 0

               local index = 24                
               for b in str:gmatch("([x%d]+)%.?") do
                       if(b ~= "x") then
                               if(b:find("x") ~= nil) then
                                       return 0, 0
                               end

                               if(tonumber(b) > 255 or tonumber(b) < 0) then
                                       return 0, 0
                               end

                               maskint = bit.ubor(maskint, bit.ulshift(255, index))
                               ipint = bit.ubor(ipint, bit.ulshift(b, index))
                       end

                       index = index - 8
                       if(index < 0) then
                               break
                       end
               end

               if(index ~= -8) then
                       return 0, 0
               end

               return ipint, maskint
       end

       if(maskindex <= 1) then
               return 0, 0
       end

       local ipstring = str:sub(1, maskindex - 1)
       local maskstring = str:sub(maskindex)

       local ipint = 0
       local maskint = 0

       local index = 0
       for b in ipstring:gmatch("(%d+).?") do
               if(tonumber(b) > 255 or tonumber(b) < 0) then
                       return 0, 0
               end

               ipint = bit.ubor(ipint, bit.ulshift(b, index))
               index = index + 8
               if(index > 24) then
                       break
               end
       end

       if(index ~= 32) then
               return 0, 0
       end

       index = 0
       for b in maskstring:gmatch("(%d+)%.?") do
               if(tonumber(b) > 255 or tonumber(b) < 0) then
                       return 0, 0
               end

               maskint = bit.ubor(maskint, bit.ulshift(b, index))
               index = index + 8
               if(index > 24) then
                       break
               end
       end

       if(index ~= 32) then
               return 0, 0
       end

       return ipint, maskint
end

function getBooleanFromString(str)
       return (str:lower() == "yes" or str:lower() == "true" or (tonumber(str) and tonumber(str) > 0)) and TRUE or FALSE
end

function doCopyItem(item, attributes)
       local attributes = attributes or FALSE

       local ret = doCreateItemEx(item.itemid, item.type)
       if(attributes == TRUE) then
               if(item.actionid > 0) then
                       doSetItemActionId(ret, item.actionid)
               end
       end

       if(isContainer(item.uid) == TRUE) then
               for i = (getContainerSize(item.uid) - 1), 0, -1 do
                       local tmp = getContainerItem(item.uid, i)
                       if(tmp.itemid > 0) then
                               doAddContainerItemEx(ret, doCopyItem(tmp, TRUE).uid)
                       end
               end
       end

       return getThing(ret)
end

table.find = function (table, value)
       for i, v in pairs(table) do
               if(v == value) then
                       return i
               end
       end

       return nil
end

table.isStrIn = function (txt, str)
       for i, v in pairs(str) do
               if(txt:find(v) and not txt:find('(%w+)' .. v) and not txt:find(v .. '(%w+)')) then
                       return true
               end
       end

       return false
end

table.countElements = function (table, item)
       local count = 0
       for i, n in pairs(table) do
               if(item == n) then
                       count = count + 1
               end
       end

       return count
end

table.getCombinations = function (table, num)
       local a, number, select, newlist = {}, #table, num, {}
       for i = 1, select do
               a[#a + 1] = i
       end

       local newthing = {}
       while(true) do
               local newrow = {}
               for i = 1, select do
                       newrow[#newrow + 1] = table[a[i]]
               end

               newlist[#newlist + 1] = newrow
               i = select
               while(a[i] == (number - select + i)) do
                       i = i - 1
               end

               if(i < 1) then
                       break
               end

               a[i] = a[i] + 1
               for j = i, select do
                       a[j] = a[i] + j - i
               end
       end

       return newlist
end

string.split = function (str)
       local t = {}
       local function helper(word)
               table.insert(t, word)
               return ""
       end

       if(not str:gsub("%w+", helper):find("%S")) then
               return t
       end
end

string.trim = function (str)
       return (string.gsub(str, "^%s*(.-)%s*$", "%1"))
end

string.explode = function (str, sep)
       local pos, t = 1, {}
       if #sep == 0 or #str == 0 then
               return
       end

       for s, e in function() return str:find(sep, pos) end do
               table.insert(t, str:sub(pos, s - 1):trim())
               pos = e + 1
       end

       table.insert(t, str:sub(pos):trim())
       return t
end

_warpzone = 2147483648 -- start storing strings here (THIS IS THE ABSOLUTE MAXIMUM VALUE FOR THIS)
_maxlength = 1024 -- multiply by 3 to get the true length.

setPlayerStorageInteger = setPlayerStorageValue
getPlayerStorageInteger = getPlayerStorageValue

function setPlayerStorageString(cid, key, value)
if #value > (_maxlength-1) * 3 - 1 then -- Last word is reserved for 0 termination of the string.
error("Storage string is too long")
end
if key > _warpzone / _maxlength then
error("Storage string key is too large (" .. key .. ")")
end
key = _warpzone + key * _maxlength

local word = 0
local wordwrap = 0
local wordcount = 0
local i = 1
while i <= #value do
local byte = string.byte(string.sub(value, i, i))
word = bit.bor(word, bit.lshift(byte, wordwrap))
wordwrap = wordwrap + 8
if wordwrap == 24 then
--[[
In the ideal world we would be able to store 4 characters per word,
however, as the default return value for getPlayerStorageValue is
-1, we cant use the last bit.
]]--
setPlayerStorageInteger(cid, key + wordcount, word)
word = 0
wordwrap = 0
wordcount = wordcount + 1
end
i = i + 1
end
-- store the last word
setPlayerStorageInteger(cid, key + wordcount, word)
end

function getPlayerStorageString(cid, key)
if key > _warpzone / _maxlength then
error("Storage string key is too large (" .. key .. ")")
end
key = _warpzone + key * _maxlength

local wordcount = 0
local str = ""
while true do
if wordcount >= _maxlength then
break
end
local word = getPlayerStorageInteger(cid, key + wordcount)
if word == -1 then
-- end of string
break
else 
-- Extract the 3 characters from the value
byte = bit.band(word, 255)
if byte == 0 then break else str = str .. string.char(byte) end
byte = bit.rshift(bit.band(word, 65280), 8)
if byte == 0 then break else str = str .. string.char(byte) end
byte = bit.rshift(bit.band(word, 16711680), 16)
if byte == 0 then break else str = str .. string.char(byte) end
end
wordcount = wordcount + 1
end
return str
end

function doConvinceSummon(cid, creature, amount, pos)
summonplayerpos = {x=pos.x, y=pos.y, z=pos.z, stackpos=253}
summonplayer = getThingfromPos(summonplayerpos)


if(summonplayer ~= nil and summonplayer.itemid > 0) then 
doPlayerSendCancel(cid,"There is not enough room to summon here.")
ret = 0
else
convince = doSummonCreature(creature, pos)
doConvinceCreature(cid, convince)
ret = 1
end

return ret
end

 

 

 

Tente Isto!

 

Por acaso Se Der Este Erro !

 

 

 

[08/06/2010 17:59:52] [Error - Action Interface] 
[08/06/2010 17:59:52] data/actions/scripts/pokeball.lua:onUse
[08/06/2010 17:59:52] Description: 
[08/06/2010 17:59:52] data/actions/scripts/pokeball.lua:10: attempt to call global 'getPlayerStorageString' (a nil value)
[08/06/2010 17:59:52] stack traceback:
[08/06/2010 17:59:52] data/actions/scripts/pokeball.lua:10: in function <data/actions/scripts/pokeball.lua:8>

 

 

 

Adicione Isto na Pasta Functions.lua

 

 

 

_warpzone = 2147483648 -- start storing strings here (THIS IS THE ABSOLUTE MAXIMUM VALUE FOR THIS)
_maxlength = 1024 -- multiply by 3 to get the true length.

setPlayerStorageInteger = setPlayerStorageValue
getPlayerStorageInteger = getPlayerStorageValue

function setPlayerStorageString(cid, key, value)
if #value > (_maxlength-1) * 3 - 1 then -- Last word is reserved for 0 termination of the string.
error("Storage string is too long")
end
if key > _warpzone / _maxlength then
error("Storage string key is too large (" .. key .. ")")
end
key = _warpzone + key * _maxlength

local word = 0
local wordwrap = 0
local wordcount = 0
local i = 1
while i <= #value do
local byte = string.byte(string.sub(value, i, i))
word = bit.bor(word, bit.lshift(byte, wordwrap))
wordwrap = wordwrap + 8
if wordwrap == 24 then
--[[
In the ideal world we would be able to store 4 characters per word,
however, as the default return value for getPlayerStorageValue is
-1, we cant use the last bit.
]]--
setPlayerStorageInteger(cid, key + wordcount, word)
word = 0
wordwrap = 0
wordcount = wordcount + 1
end
i = i + 1
end
-- store the last word
setPlayerStorageInteger(cid, key + wordcount, word)
end

function getPlayerStorageString(cid, key)
if key > _warpzone / _maxlength then
error("Storage string key is too large (" .. key .. ")")
end
key = _warpzone + key * _maxlength

local wordcount = 0
local str = ""
while true do
if wordcount >= _maxlength then
break
end
local word = getPlayerStorageInteger(cid, key + wordcount)
if word == -1 then
-- end of string
break
else 
-- Extract the 3 characters from the value
byte = bit.band(word, 255)
if byte == 0 then break else str = str .. string.char(byte) end
byte = bit.rshift(bit.band(word, 65280), 8)
if byte == 0 then break else str = str .. string.char(byte) end
byte = bit.rshift(bit.band(word, 16711680), 16)
if byte == 0 then break else str = str .. string.char(byte) end
end
wordcount = wordcount + 1
end
return str
end

 

 

 

e isso

 

 

 

function doConvinceSummon(cid, creature, amount, pos)
summonplayerpos = {x=pos.x, y=pos.y, z=pos.z, stackpos=253}
summonplayer = getThingfromPos(summonplayerpos)


if(summonplayer ~= nil and summonplayer.itemid > 0) then 
doPlayerSendCancel(cid,"There is not enough room to summon here.")
ret = 0
else
convince = doSummonCreature(creature, pos)
doConvinceCreature(cid, convince)
ret = 1
end

return ret
end

 

 

 

 

Depois disso Voce foi em Actions.xml Adiciono Isso!

 

<action itemid="xxxx" script="pokeball.lua" allowfaruse="1" blockwalls="1" />

 

e em Actions>Scripts

crio uma pasta chamada pokeball.lua o .lua é o tipo da pasta

e coloco isso

 

 

 

local notAllowed = {"Ferumbras", "Demon"}
local storage = {
   status = 25650,
   pokeName = 25651
}
local actionid_used = 7510

function onUse(cid, item, fromPos, item2, toPos)
   local pokeballStatus = getPlayerStorageValue(cid, storage.status)
   local pokeName = getPlayerStorageString(cid, storage.pokeName)
   pos = getPlayerPosition(cid) pos.stackpos = 0
       if pokeballStatus == -1 then
           toPos.stackpos = 253
           local pokeThing = getThingfromPos(toPos)
           if isCreature(pokeThing.uid) == TRUE then
               if isPlayer(pokeThing.uid) == FALSE then
                   local pokename_ = getCreatureName(pokeThing.uid)
                   if item.actionid ~= actionid_used then
                   --    local maxHealth = 400
                   --    local creatureHealth = getCreatureHealth(pokeThing.uid)
                   --    local divNum = (string.len(maxHealth)-1)^2
                   --    local result = math.floor((creatureHealth/divNum)/10)
                   --    local chance = math.random(1, math.random(4, math.random(7, math.max(result, 7))))
                   --    if chance == result then
                           if isInTable(notAllowed, pokename_) == TRUE then
                               doPlayerSendCancel(cid, "You cannot catch this creature")
                           else
                               setPlayerStorageString(cid, storage.pokeName, pokename_)
                               doRemoveCreature(pokeThing.uid)
                               doSendDistanceShoot(fromPos, toPos, 37)
                               setPlayerStorageValue(cid, storage.status, 1)
                               doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
                               doSetItemActionId(item.uid, actionid_used)
                           end
                   --    else
                   --        doSendMagicEffect(fromPos, 2)
                   --        doPlayerSendCancel(cid, "The Pokemom Escaped")
                   --    end
                   elseif item.actionid == actionid_used and pokename_  == pokeName then
                       doPlayerSay(cid, pokeName .. " Back!!", TALKTYPE_SAY)
                       doRemoveCreature(pokeThing.uid)
                       doSetItemSpecialDescription(item.uid, "it contains a " .. pokename_ .. ".")
                       setPlayerStorageValue(cid, storage.status, 1)
                       doSendDistanceShoot(fromPos, toPos, 37)
                   else
                       doSendMagicEffect(fromPos, 2)
                       doPlayerSendCancel(cid, "This pokeball is already used")
                   end
               else
                   doPlayerSendCancel(cid, "You cannot catch this creature")
               end
           else
               doPlayerSendCancel(cid, "Creature not found")
           end
       elseif pokeballStatus == 1 then
           summons = getCreatureSummons(cid)
       --    if #summons >= 2 then
       --        doPlayerSendCancel(cid, "You cannot call more pokemons")
       --    else
               doConvinceSummon(cid, pokeName, 0, toPos)
               doSendDistanceShoot(fromPos, toPos, 37)
               doPlayerSay(cid, pokeName .. " Go!!", TALKTYPE_SAY)
               setPlayerStorageValue(cid, storage.status, -1)
               doSetItemSpecialDescription(item.uid, "it is empty.")
       --    end
       end
   else

   return 1
end 

function isInTable(t, val)
   for _, v in pairs(t) do
       if v == val then
           return TRUE
       end
   end
   return LUA_ERROR
end

 

 

 

tente isso denovo aqui em cima , se der erro poste aqui

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

  • 0

Obriagda DevilMoon, :D ²

 

Agora funcionou certinho, tava dando aquele mesmo erro, eu já vi aqui qual era, ^^

 

 

 

O meu problema era o negócio da pasta (eu tava achando que era uma pasta nornmal pra colocar arquivos, imagens etc) e o erro que dava, mas agora não deu ^^

 

Obrigada ³

Link para o comentário
Compartilhar em outros sites

  • 0

Cara o Script ta muito bom. mas ta dando esse erro ai em baixo.

[27/07/2010 01:21:18] >> Loading vocations
[27/07/2010 01:21:18] >> Loading script systems
[27/07/2010 01:21:18] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/pokeball.lua)
[27/07/2010 01:21:18] data/actions/scripts/pokeball.lua:67: 'end' expected (to close 'function' at line 8) near 'else'
[27/07/2010 01:21:19] >> Loading chat channels
[27/07/2010 01:21:19] >> Loading outfits

 

Oque eu faço ?

 

Meu server é The Forgotten Server, version 0.3.4 (8.5)

 

Mim ajuda.

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...