Ir para conteúdo
  • Cadastre-se

Posts Recomendados

Salve galera, 

 

Esse é meu primeiro post aqui no fórum então me desculpe caso esteja postando no lugar errado.

Estou com 2 problemas na minha anti-entrosa: 

 

O primeiro é que não consigo selecionar o número de players de cada guild, ela está configurando o número de frags total para cada guild, por exemplo se colocarmos 50 frags e cada time tem 10 players quando tiver acontecido 40 mortes de 1 lado quem morrer não consegue mais voltar para citywar e a guerra acaba quando o ultimo é morto totalizando os 50 frags. (Pode entrar quantos players a guild tiver, queria que desse pra estipular o número de players de cada guild que podem entrar).

 

O segundo é que não está bloqueando equipar SSA e Might ring, e também não bloqueia os summons.

 

Vou colocar abaixo meus scripts.

 

LIB 

Citar

function isInArray(array, value, caseSensitive)
    if(caseSensitive == nil or caseSensitive == false) and type(value) == "string" then
        local lowerValue = value:lower()
        for _, _value in ipairs(array) do
            if type(_value) == "string" and lowerValue == _value:lower() then
                return true
            end
        end
    else
        for _, _value in ipairs(array) do
            if (value == _value) then return true end
        end
    end

    return false
end

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

    return true
end

function doPlayerGiveItemContainer(cid, containerid, itemid, amount, subType)
    for i = 1, amount do
        local container = doCreateItemEx(containerid, 1)
        for x = 1, getContainerCapById(containerid) do
            doAddContainerItem(container, itemid, subType)
        end

        if(doPlayerAddItemEx(cid, container, true) ~= RETURNVALUE_NOERROR) then
            return false
        end
    end

    return true
end

function doPlayerTakeItem(cid, itemid, amount)
    return getPlayerItemCount(cid, itemid) >= amount and doPlayerRemoveItem(cid, itemid, amount)
end

function doPlayerSellItem(cid, itemid, count, cost)
    if(not doPlayerTakeItem(cid, itemid, count)) then
        return false
    end

    if(not doPlayerAddMoney(cid, cost)) then
        error('[doPlayerSellItem] Could not add money to: ' .. getPlayerName(cid) .. ' (' .. cost .. 'gp).')
    end

    return true
end

function doPlayerWithdrawMoney(cid, amount)
    if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
    end

    local balance = getPlayerBalance(cid)
    if(amount > balance or not doPlayerAddMoney(cid, amount)) then
        return false
    end

    doPlayerSetBalance(cid, balance - amount)
    return true
end

function doPlayerDepositMoney(cid, amount)
    if(not getBooleanFromString(getConfigInfo('bankSystem'))) then
        return false
    end

    if(not doPlayerRemoveMoney(cid, amount)) then
        return false
    end

    doPlayerSetBalance(cid, getPlayerBalance(cid) + amount)
    return true
end

function doPlayerAddStamina(cid, minutes)
    return doPlayerSetStamina(cid, getPlayerStamina(cid) + minutes)
end

function isPremium(cid)
    return (isPlayer(cid) and (getPlayerPremiumDays(cid) > 0 or getBooleanFromString(getConfigValue('freePremium'))))
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"
    end

    return "th"
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 doNumberFormat(i)
    local str, found = string.gsub(i, "(%d)(%d%d%d)$", "%1,%2", 1), 0
    repeat
        str, found = string.gsub(str, "(%d)(%d%d%d),", "%1,%2,", 1)
    until found == 0
    return str
end

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

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

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

    if(num) then
        return {hours = hours, minutes = minutes}
    end

    return {hours =  hours < 10 and '0' .. hours or '' .. hours, minutes = minutes < 10 and '0' .. minutes or '' .. minutes}
end

function getCount (s)
    return tonumber(s) and s or tonumber(s:match ("%d+")) or 0
end

function doWriteLogFile(file, text)
    local f = io.open(file, "a+")
    if(not f) then
        return false
    end

    f:write("[" .. os.date("%d/%m/%Y %H:%M:%S") .. "] " .. text .. "\n")
    f:close()
    return true
end

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

function doMutePlayer(cid, time, sub)
    local condition = createConditionObject(CONDITION_MUTED, (time == -1 and time or time * 1000))
    if(type(sub) == 'number') then
        setConditionParam(condition, CONDITION_PARAM_SUBID, sub, false)
    end

    return doAddCondition(cid, condition, false)
end

function doSummonCreature(name, pos)
    local cid = doCreateMonster(name, pos, false, false)
    if(not cid) then
        cid = doCreateNpc(name, pos)
    end

    return cid
end

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

    return players
end

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

function isPlayer(cid)
    return isCreature(cid) and cid >= AUTOID_PLAYERS and cid < AUTOID_MONSTERS
end

function isPlayerGhost(cid)
    return isPlayer(cid) and (getCreatureCondition(cid, CONDITION_GAMEMASTER, GAMEMASTER_INVISIBLE, CONDITIONID_DEFAULT) or getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBESEEN))
end

function isMonster(cid)
    return isCreature(cid) and cid >= AUTOID_MONSTERS and cid < AUTOID_NPCS
end

function isNpc(cid)
    -- Npc IDs are over int32_t range (which is default for lua_pushnumber),
    -- therefore number is always a negative value.
    return isCreature(cid) and (cid < 0 or cid >= AUTOID_NPCS)
end

function isUnderWater(cid)
    return isInArray(underWater, getTileInfo(getCreaturePosition(cid)).itemid)
end

function doPlayerAddLevel(cid, amount, round)
    local experience, level, amount = 0, getPlayerLevel(cid), amount or 1
    if(amount > 0) then
        experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level))
    else
        experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount))
    end

    return doPlayerAddExperience(cid, experience)
end

function doPlayerAddMagLevel(cid, amount)
    local amount = amount or 1
    for i = 1, amount do
        doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false)
    end

    return true
end

function doPlayerAddSkill(cid, skill, amount, round)
    local amount = amount or 1
    if(skill == SKILL__LEVEL) then
        return doPlayerAddLevel(cid, amount, round)
    elseif(skill == SKILL__MAGLEVEL) then
        return doPlayerAddMagLevel(cid, amount)
    end

    for i = 1, amount do
        doPlayerAddSkillTry(cid, skill, getPlayerRequiredSkillTries(cid, skill, getPlayerSkillLevel(cid, skill) + 1) - getPlayerSkillTries(cid, skill), false)
    end

    return true
end

function isPrivateChannel(channelId)
    return channelId >= CHANNEL_PRIVATE
end

function doBroadcastMessage(text, class)
    local class = class or MESSAGE_STATUS_WARNING
    if(type(class) == 'string') then
        local className = MESSAGE_TYPES[class]
        if(className == nil) then
            return false
        end

        class = className
    elseif(class < MESSAGE_FIRST or class > MESSAGE_LAST) then
        return false
    end

    for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendTextMessage(pid, class, text)
    end

    print("> Broadcasted message: \"" .. text .. "\".")
    return true
end

function doPlayerBroadcastMessage(cid, text, class, checkFlag, ghost)
    local checkFlag, ghost, class = checkFlag or true, ghost or false, class or TALKTYPE_BROADCAST
    if(checkFlag and not getPlayerFlagValue(cid, PLAYERFLAG_CANBROADCAST)) then
        return false
    end

    if(type(class) == 'string') then
        local className = TALKTYPE_TYPES[class]
        if(className == nil) then
            return false
        end

        class = className
    elseif(class < TALKTYPE_FIRST or class > TALKTYPE_LAST) then
        return false
    end

    for _, pid in ipairs(getPlayersOnline()) do
        doCreatureSay(cid, text, class, ghost, pid)
    end

    print("> " .. getCreatureName(cid) .. " broadcasted message: \"" .. text .. "\".")
    return true
end

function doCopyItem(item, attributes)
    local attributes = ((type(attributes) == 'table') and attributes or { "aid" })

    local ret = doCreateItemEx(item.itemid, item.type)
    for _, key in ipairs(attributes) do
        local value = getItemAttribute(item.uid, key)
        if(value ~= nil) then
            doItemSetAttribute(ret, key, value)
        end
    end

    if(isContainer(item.uid)) 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, attributes).uid)
            end
        end
    end

    return getThing(ret)
end

function doSetItemText(uid, text, writer, date)
    local thing = getThing(uid)
    if(thing.itemid < 100) then
        return false
    end

    doItemSetAttribute(uid, "text", text)
    if(writer ~= nil) then
        doItemSetAttribute(uid, "writer", tostring(writer))
        if(date ~= nil) then
            doItemSetAttribute(uid, "date", tonumber(date))
        end
    end

    return true
end

function getItemWeightById(itemid, count, precision)
    local item, count, precision = getItemInfo(itemid), count or 1, precision or false
    if(not item) then
        return false
    end

    if(count > 100) then
        -- print a warning, as its impossible to have more than 100 stackable items without "cheating" the count
        print('[Warning] getItemWeightById', 'Calculating weight for more than 100 items!')
    end

    local weight = item.weight * count
    return precission and weight or math.round(weight, 2)
end

function choose(...)
    local arg = {...}
    return arg[math.rand(1, table.maxn(arg))]
end

function doPlayerAddExpEx(cid, amount)
    if(not doPlayerAddExp(cid, amount)) then
        return false
    end

    local position = getThingPosition(cid)
    doPlayerSendTextMessage(cid, MESSAGE_EXPERIENCE, "You gained " .. amount .. " experience.", amount, COLOR_WHITE, position)

    local spectators, name = getSpectators(position, 7, 7), getCreatureName(cid)
    for _, pid in ipairs(spectators) do
        if(isPlayer(pid) and cid ~= pid) then
            doPlayerSendTextMessage(pid, MESSAGE_EXPERIENCE_OTHERS, name .. " gained " .. amount .. " experience.", amount, COLOR_WHITE, position)
        end
    end

    return true
end

function getItemTopParent(uid)
    local parent = getItemParent(uid)
    if(not parent or parent.uid == 0) then
        return nil
    end

    for i = 1, 1000 do
        local tmp = getItemParent(parent.uid)
        if(tmp and tmp.uid ~= 0 and (not parent or parent.uid == 0 or tmp.uid ~= parent.uid)) then
            parent = tmp
        else
            break
        end
    end

    return parent
end

function getItemHolder(uid)
    local parent = getItemParent(uid)
    if(not parent or parent.uid == 0) then
        return nil
    end

    local holder = nil
    for i = 1, 1000 do
        local tmp = getItemParent(parent.uid)
        if(tmp and tmp.uid ~= 0 and (not parent or parent.uid == 0 or tmp.uid ~= parent.uid)) then
            if(tmp.itemid == 1) then -- a creature
                holder = tmp
                break
            end

            parent = tmp
        else
            break
        end
    end

    return holder
end

function valid(f)
    return function(p, ...)
        if(isCreature(p)) then
            return f(p, ...)
        end
    end
end

function addContainerItems(container,items)
    local items_mod = {}
    for _, it in ipairs(items) do
        if( isItemStackable(it.id) and it.count > 100) then
            local c = it.count
            while( c > 100 ) do
                table.insert(items_mod,{id = it.id,count = 100})
                c = c - 100
            end
            if(c > 0) then
                table.insert(items_mod,{id = it.id,count = c})
            end
        else
            table.insert(items_mod,{id = it.id,count = 1})
        end
    end

    local free = getContainerCap(container.uid) - (getContainerSize(container.uid) )
    local count = math.ceil(#items_mod/ free)
    local main_bp = container.uid
    local insert_bp = main_bp
    local counter = 1
    for c,it in ipairs(items_mod) do
        local _c = isItemStackable(it.id) and (it.count > 100 and 100 or it.count) or 1
        if count > 1 then
            if (counter < free) then
                doAddContainerItem(insert_bp, it.id, _c)
            else
                insert_bp = doAddContainerItem(insert_bp, container.itemid, 1)
                count = (#items_mod)-(free-1)
                free = getContainerCap(insert_bp) 
                count = math.ceil(count/ free)
                doAddContainerItem(insert_bp, it.id, _c)
                counter = 1
            end
            counter = counter + 1
        else
            doAddContainerItem(insert_bp, it.id, _c)
        end
    end

    return main_bp
end

function comparePositions(pos1, pos2)
    if(pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z) then
        return TRUE
    end
   
    return FALSE
end

function getContainerItemCount(uid, itemid, recursive)
    local c, s = 0, getContainerSize(uid)
    for i = 1, s do
        local thing = getContainerItem(uid, (i - 1))
        if(thing.uid ~= 0) then
            if(recursive and isContainer(thing.uid)) then
                c = c + getContainerItemCount(thing.uid, itemid, recursive)
            end

            if(thing.itemid == itemid) then
                c = c + thing.type
            end
        end
    end

    return c
end

function getContainerItems(uid, itemid, recursive)
    local a, s = {}, getContainerSize(uid)
    for i = 1, s do
        local thing = getContainerItem(uid, (i - 1))
        if(thing.uid ~= 0) then
            if(recursive and isContainer(thing.uid)) then
                a = table.merge(a, getContainerItems(thing.uid, itemid, true))
            end

            if(thing.itemid == itemid) then
                table.insert(a, thing)
            end
        end
    end

    return a
end

-- Focus Save
function doPlayerSaveEx(cid)
    doCreatureSetStorage(cid, "save")
    local result = doPlayerSave(cid)
    doCreatureSetStorage(cid, "save", (os.time() + math.random(30, 90)))
    return result
end
-- Focus Save

function doPlayerBuyItem(cid, itemid, count, cost, charges)
    return doPlayerRemoveMoneyEx(cid, cost) and doPlayerGiveItem(cid, itemid, count, charges)
end

function doPlayerBuyItemContainer(cid, containerid, itemid, count, cost, charges)
    return doPlayerRemoveMoneyEx(cid, cost) and doPlayerGiveItemContainer(cid, containerid, itemid, count, charges)
end

function isRookie(cid, promoted)
    local arr = {0}
    if(promoted) then
        table.remove(arr, 1)
    end

    return isInArray(arr, getPlayerVocation(cid))
end

function doGenerateCode()
    local chars = {}
    for i = 1, 8 do
        local tmp = math.rand(1, (i == 1 and 2 or 3))
        if(tmp == 1) then
            table.insert(chars, math.rand(65, 90))
        elseif(tmp == 2) then
            table.insert(chars, math.rand(97, 122))
        else
            table.insert(chars, math.rand(48, 57))
        end
    end

    return string.format("%c%c%c%c%c%c%c%c", chars[1], chars[2], chars[3], chars[4], chars[5], chars[6], chars[7], chars[8])
end

function efeitosAura(i,tm,cid)
    if(isCreature(cid)) then
        local atual = getCreaturePosition(cid)
        local posaura = {
            {x=(atual.x)-1, y=(atual.y)-1, z=atual.z},
            {x=atual.x, y=(atual.y)-1, z=atual.z},
            {x=(atual.x)+1, y=(atual.y)-1, z=atual.z},
            {x=(atual.x)+1, y=atual.y, z=atual.z},
            {x=(atual.x)+1, y=(atual.y)+1, z=atual.z},
            {x=atual.x, y=(atual.y)+1, z=atual.z},
            {x=(atual.x)-1, y=(atual.y)+1, z=atual.z},
            {x=(atual.x)-1, y=atual.y, z=atual.z},
        }
        local chances = math.random(100)
        if (chances <= 50/8 and getCreatureHealth(cid)<getCreatureMaxHealth(cid)) or (chances <= 50/8 and getCreatureMana(cid)<getCreatureMaxMana(cid))then -- 50 = 50% de chances de curar em cada volta... (8 voltas)
            if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
                doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/100 * 2) -- hp/mana max que irá curar. (No caso, irá curar 2% à cada volta)
                doCreatureAddMana(cid, getCreatureMaxMana(cid)/100 * 4) -- hp/mana max que irá curar. (No caso, irá curar 2% à cada volta)
            elseif getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
                doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/100 * 3) -- hp/mana max que irá curar. (No caso, irá curar 2% à cada volta)
                doCreatureAddMana(cid, getCreatureMaxMana(cid)/100 * 3) -- hp/mana max que irá curar. (No caso, irá curar 2% à cada volta)
            else
                doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/100 * 4) -- hp/mana max que irá curar. (No caso, irá curar 2% à cada volta)
                doCreatureAddMana(cid, getCreatureMaxMana(cid)/100 * 2) -- hp/mana max que irá curar. (No caso, irá curar 2% à cada volta)
            end
            
            if(i<=8 and i>1) then
                if getCreatureStorage(cid, 25951) <= 0 then -- !aura on / off
                    if getCreatureStorage(cid, 25952) <= 0 then -- efeito aura (!aura 1, 2, 3)
                        doSendMagicEffect(atual, CONST_ME_HEARTS) -- efeito da aura
                    elseif getCreatureStorage(cid, 25952) == 1 then
                        if getCreatureLookDirection(cid) == NORTH or getCreatureLookDirection(cid) == EAST then
                            doSendMagicEffect(atual, 60) -- efeito da aura
                        else
                            doSendMagicEffect(atual, 59) -- efeito da aura
                        end
                    elseif getCreatureStorage(cid, 25952) == 2 then
                        doSendMagicEffect(atual, CONST_ME_BATS) -- aura
                    elseif getCreatureStorage(cid, 25952) == 3 then
                        doSendMagicEffect(atual, CONST_ME_INSECTS) -- aura
                    elseif getCreatureStorage(cid, 25952) == 4 then
                        doSendMagicEffect(atual, CONST_ME_STUN) -- aura
                    elseif getCreatureStorage(cid, 25952) == 5 then
                        doSendDistanceShoot({x=(atual.x)-1, y=atual.y, z=atual.z}, {x=atual.x, y=(atual.y)-1, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                        doSendDistanceShoot({x=atual.x, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=atual.y, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                        doSendDistanceShoot({x=(atual.x)+1, y=atual.y, z=atual.z}, {x=atual.x, y=(atual.y)+1, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                        doSendDistanceShoot({x=atual.x, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=atual.y, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    end
                end
                --if getCreatureLookDirection(cid) == NORTH or getCreatureLookDirection(cid) == EAST then
                --    doSendMagicEffect(atual, 60) -- efeito da aura
                --else
                --    doSendMagicEffect(atual, 59) -- efeito da aura
                --end                
            end
            --doSendMagicEffect(atual, 35) -- efeito de cura
            doSendMagicEffect(atual, CONST_ME_MAGIC_RED) -- cura
        end
            
        if(i==8) then
            if getCreatureStorage(cid, 25951) <= 0 then -- !aura on / off
                if getCreatureStorage(cid, 25952) <= 0 then -- efeito aura (!aura 1, 2, 3)
                    doSendMagicEffect(atual, CONST_ME_HEARTS) -- efeito da aura
                elseif getCreatureStorage(cid, 25952) == 1 then
                    if getCreatureLookDirection(cid) == NORTH or getCreatureLookDirection(cid) == EAST then
                        doSendMagicEffect(atual, 60) -- efeito da aura
                    else
                        doSendMagicEffect(atual, 59) -- efeito da aura
                    end
                elseif getCreatureStorage(cid, 25952) == 2 then
                    doSendMagicEffect(atual, CONST_ME_BATS) -- aura
                elseif getCreatureStorage(cid, 25952) == 3 then
                    doSendMagicEffect(atual, CONST_ME_INSECTS) -- aura
                elseif getCreatureStorage(cid, 25952) == 4 then
                    doSendMagicEffect(atual, CONST_ME_STUN) -- aura
                elseif getCreatureStorage(cid, 25952) == 5 then
                    doSendDistanceShoot({x=(atual.x)-1, y=atual.y, z=atual.z}, {x=atual.x, y=(atual.y)-1, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    doSendDistanceShoot({x=atual.x, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=atual.y, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    doSendDistanceShoot({x=(atual.x)+1, y=atual.y, z=atual.z}, {x=atual.x, y=(atual.y)+1, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    doSendDistanceShoot({x=atual.x, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=atual.y, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                end
            end
            --if getCreatureLookDirection(cid) == NORTH or getCreatureLookDirection(cid) == EAST then
            --    doSendMagicEffect(atual, 60) -- efeito da aura
            --else
            --    doSendMagicEffect(atual, 59) -- efeito da aura
            --end
        elseif(i<8) then
            if getCreatureStorage(cid, 25951) <= 0 then -- !aura on / off
                if getCreatureStorage(cid, 25952) <= 0 then -- efeito aura (!aura 1, 2, 3)
                    doSendMagicEffect(atual, CONST_ME_HEARTS) -- efeito da aura
                elseif getCreatureStorage(cid, 25952) == 1 then
                    if getCreatureLookDirection(cid) == NORTH or getCreatureLookDirection(cid) == EAST then
                        doSendMagicEffect(atual, 60) -- efeito da aura
                    else
                        doSendMagicEffect(atual, 59) -- efeito da aura
                    end
                elseif getCreatureStorage(cid, 25952) == 2 then
                    doSendMagicEffect(atual, CONST_ME_BATS) -- aura
                elseif getCreatureStorage(cid, 25952) == 3 then
                    doSendMagicEffect(atual, CONST_ME_INSECTS) -- aura
                elseif getCreatureStorage(cid, 25952) == 4 then
                    doSendMagicEffect(atual, CONST_ME_STUN) -- aura
                elseif getCreatureStorage(cid, 25952) == 5 then
                    doSendDistanceShoot({x=(atual.x)-1, y=atual.y, z=atual.z}, {x=atual.x, y=(atual.y)-1, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    doSendDistanceShoot({x=atual.x, y=(atual.y)-1, z=atual.z}, {x=(atual.x)+1, y=atual.y, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    doSendDistanceShoot({x=(atual.x)+1, y=atual.y, z=atual.z}, {x=atual.x, y=(atual.y)+1, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                    doSendDistanceShoot({x=atual.x, y=(atual.y)+1, z=atual.z}, {x=(atual.x)-1, y=atual.y, z=atual.z}, CONST_ANI_ENERGYBALL) -- aura
                end
            end
            --if getCreatureLookDirection(cid) == NORTH or getCreatureLookDirection(cid) == EAST then
            --    doSendMagicEffect(atual, 60) -- efeito da aura
            --else
            --    doSendMagicEffect(atual, 59) -- efeito da aura
            --end
        end
        
        if(i<=8 and getPlayerStorageValue(cid, 25950) == 1) then -- STOR AURA
            i = i+1
            tm = 25000/8 -- 7000 = 7seg para dar uma volta (tempo do efeito + volta)
            return addEvent(efeitosAura,tm,i,tm,cid)
        elseif(i>8 and getPlayerStorageValue(cid, 25950) == 1) then -- STOR AURA
            return efeitosAura(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end

function getGuildNameById(id)
    local resultId = db.storeQuery(string.format('SELECT `name` FROM `guilds` WHERE `id` = %d', id))
    if resultId then
        local guildName = result.getString(resultId, "name")
        result.free(resultId)
        return guildName
    end

    return 0
end

function isInWar(guildId, enemyId)
    local resultId = db.storeQuery(string.format('SELECT `id` FROM `guild_wars` WHERE `status` = 1 AND ((`guild_id` = %d AND `enemy_id` = %d) OR (`guild_id` = %d AND `enemy_id` = %d))', guildId, enemyId, enemyId, guildId))
    if resultId then
        result.free(resultId)
        return true
    end

    return false
end

local SSAMight = {2197, 2164}

function onThrow(cid, item, fromPosition, toPosition)
    if getPlayerStorageValue(cid, ANTIENTROSA_BLOCK_SSAMIGHTRING) == 1 and isInArray(SSAMight, item.id) then
        if fromPosition.x == 65535 then
            if toPosition.y == CONST_SLOT_NECKLACE or toPosition.y == CONST_SLOT_RING then   
                doPlayerSendCancel(cid, "Você não pode equipar SSA nem might ring.")
                return false
            end
        end    
    end
    return true
end

Talk Actions

Citar

function onSay(cid, words, param, channel)
if(not checkExhausted(cid, 666, 2)) then
    return true
end

    local playerGuild, p = getPlayerGuildId(cid), string.explode(param,",")
    if param == "" then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Comando inválido.")
        return true
    end

    if playerGuild <= 0 then
        doPlayerSendCancel(cid, "[War Anti-Entrosa] Você precisa estar em uma Guild para usar eses comando.")
        return true
    end

    if getPlayerLevel(cid) < 50 then
        doPlayerSendCancel(cid, "[War Anti-Entrosa] Você precisa ser no mínimo level 50 para usar esse comando.")
        return true
    end

    local action = p[1]
    if action == "invite" then        
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você precisa ser líder da Guild para poder enviar um pedido de War.")
            return true
        end

        if AntiEntrosa:warInfo(playerGuild) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] A sua Guild já está em uma War no Anti-Entrosa, aguarde ela terminar.")
            return true
        end

        local cityName = p[2]
        if not cityName then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina um nome da cidade para o Anti-Entrosa.")
            return true
        end

        local arenaId = AntiEntrosa:arenaExists(cityName)
        if not arenaId then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] O nome dessa cidade não existe.")
            return true
        end

        local cityAvaliable = AntiEntrosa:arenaIsFree(arenaId)
        if not cityAvaliable then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Essa cidade não está disponível atualmente para War.")
            return true
        end

        -- Tempo em minutos da Wars 
        local timeWar = tonumber(p[3])
        if not timeWar then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina a tempo em minutos para cado lado.")
            return true
        elseif not isInArray(AntiEntrosa.timeAvaliable, timeWar) then
            local str = ''
            for i = 1, #AntiEntrosa.timeAvaliable do
                local time = AntiEntrosa.timeAvaliable
                str = string.format('%s %d', str, time)
            end

            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, string.format('[War Anti-Entrosa] As opções de tempo são apenas de %s. Por favor escolha um desses Tempos.', str))
            return true
        end

        -- Level mínimo para entrar
        local minLevel = p[4]
        if not minLevel then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Por favor defina o level máximo dos players para o Anti-Entrosa.")
            return true
        else
            if (type(minLevel) == "string") then
                if minLevel:lower() == "disabled" then
                    minLevel = false
                else
                    minLevel = tonumber(minLevel)
                end

                if (type(minLevel) == "number") then
                    if minLevel <= 0 then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, '[War Anti-Entrosa] O level não pode ser negativo. Caso não queira limite, coloque "disabled".')
                        return true
                    end
                end
            else
                return true
            end
        end

        -- UE ativada?
        local ueEnabled = p[5]
        if not ueEnabled then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se UE estará enabled ou disabled.")
            return true
        else
            ueEnabled = ueEnabled:lower()
            if ueEnabled == "enabled" then
                ueEnabled = true
            elseif ueEnabled == "disabled" then
                ueEnabled = false
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se UE é ou não permitido.")
                return true
            end
        end

        -- Runas ativadas? 
        local runesEnabled = p[6]
        if not runesEnabled then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se Runas estarão enabled ou disabled.")
            return true
        else
            runesEnabled = runesEnabled:lower()
            if runesEnabled == "enabled" then
                runesEnabled = true
            elseif runesEnabled == "disabled" then
                runesEnabled = false
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se Runas são ou não permitidas.")
                return true
            end
        end

        -- SSA ativado?
        local ssaMightRingBlocked = p[7]
        if not ssaMightRingBlocked then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se SSA e Might Ring estarão enabled ou disabled.")
            return true
        else
            ssaMightRingBlocked = ssaMightRingBlocked:lower()
            if ssaMightRingBlocked == "enabled" then
                ssaMightRingBlocked = true
            elseif ssaMightRingBlocked == "disabled" then
                ssaMightRingBlocked = false
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se SSA e Might são ou não permitidos.")
                return true
            end
        end

        -- Summons blockiados?
        local summonsBlocked = p[8]
        if not summonsBlocked then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se os Summons estarão enabled ou disabled.")
            return true
        else
            summonsBlocked = summonsBlocked:lower()
            if summonsBlocked == "enabled" then
                summonsBlocked = true
            elseif summonsBlocked == "disabled" then
                summonsBlocked = false
            else
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina corretamente se Summons são ou não permitidos.")
                return true
            end
        end

        -- Definir a quantidade de players
        local maximumPlayers = tonumber(p[9])
        if not maximumPlayers then
            maximumPlayers = 0
        elseif maximumPlayers < AntiEntrosa.minPlayers and maximumPlayers ~= 0 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] A quantidade de Frags máxima por guild é de ".. AntiEntrosa.minPlayers ..".")
            return true
        elseif maximumPlayers > AntiEntrosa.maxPlayers then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] A quantidade de Frags máxima por guild é de ".. AntiEntrosa.maxPlayers .." ou ilimitado.")
            return true
        end

        -- Definir a Guild contra
        local guildEnemy = p[10]
        if not guildEnemy then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Defina o nome da guild inimiga.")
            return true
        end

        local enemyGuildId = getGuildId(guildEnemy)
        if not enemyGuildId or enemyGuildId == 0 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Essa Guild não existe.")
            return true
        end

        if enemyGuildId == playerGuild then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você não pode convidar a sua própria Guild para uma War.")
            return true
        end
        
        if AntiEntrosa:warInfo(enemyGuildId) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Essa guild já foi convidada por outra guild.")
            return true
        end

        local enemyGuildName = getGuildNameById(enemyGuildId)
        if not isInWar(playerGuild, enemyGuildId) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, string.format("[War Anti-Entrosa] Sua Guild precisa estar em WarSystem contra a Guild %s para poder enviar um pedido de War no Anti-Entrosa.", enemyGuildName))
            return true
        end

        local hasInvitation = AntiEntrosa:hasInvitation(playerGuild, enemyGuildId)
        if hasInvitation then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, string.format("[War Anti-Entrosa] Já existe um convite de War contra a Guild %s.", enemyGuildName))
            return true
        end
        
        if getPlayerMoney(cid) >= 350000 then -- gold coin
            if doPlayerRemoveMoney(cid, 350000) then -- gold coin
                AntiEntrosa:sendInvitation(cid, arenaId, playerGuild, enemyGuildId, timeWar, minLevel, ueEnabled, runesEnabled, ssaMightRingBlocked, summonsBlocked, maximumPlayers)
            else
                doPlayerSendCancel(cid, "ERROR! Contact the Administrator.")
                return true
            end
        else
            doPlayerSendCancel(cid, "[War Anti-Entrosa] Taxa para enviar um convite no Anti-Entrosa é de 350k.")
            return true
        end

    elseif action == "accept" then
        local guildEnemy = p[2]
        local enemyGuildId = getGuildId(guildEnemy)
        if not enemyGuildId or enemyGuildId == 0 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Essa Guild não existe.")
            return true
        end

        if enemyGuildId == playerGuild then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você não pode executar essa ação.")
            return true
        end
        
        if getPlayerGuildLevel(cid) < 3 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você precisa ser líder da Guild para poder enviar um pedido de War.")
            return true
        end

        local enemyGuildName = getGuildNameById(enemyGuildId)
        local hasInvitation = AntiEntrosa:hasInvitation(playerGuild, enemyGuildId)
        if not hasInvitation then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, string.format("[War Anti-Entrosa] Não existe nenhum convite de War da Guild %s.", enemyGuildName))
            return true
        end
        
        local arenaId = AntiEntrosa:getWarIdByGuild(playerGuild)
        if arenaId then
            if getPlayerMoney(cid) >= 150000 then -- gold coin
                if doPlayerRemoveMoney(cid, 150000) then -- gold coin
                    AntiEntrosa:confirmInvitation(cid, arenaId)
                else
                    doPlayerSendCancel(cid, "ERROR! Contact the Administrator.")
                    return true
                end
            else
                doPlayerSendCancel(cid, "[War Anti-Entrosa] Taxa para aceitar o Anti-Entrosa é de 150k.")
                return true
            end
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Não foi possível aceitar o pedido de War no Anti-Entrosa.")
        end
        
    elseif action == "cancel" then
        local guildEnemy = p[2]
        local enemyGuildId = getGuildId(guildEnemy)
        if not enemyGuildId or enemyGuildId == 0 then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Essa Guild não existe.")
            return true
        end

        if enemyGuildId == playerGuild then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você não pode executar essa ação.")
            return true
        end
        
        local warInfo = AntiEntrosa:warInfo(playerGuild)
        if not warInfo then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] A sua Guild não possui uma War Ativa atualmente.")
            return true
        end
        
        local enemyGuildName = getGuildNameById(enemyGuildId)
        local canCancel = AntiEntrosa:canCancelInvitation(playerGuild)
        if not canCancel then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você não pode cancelar o pedido dessa War no Anti-Entrosa.")
            return true
        end

        local arenaId = AntiEntrosa:getWarIdByGuild(playerGuild)
        if arenaId then
            AntiEntrosa:cancelInvitation(cid, arenaId)
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Não foi possível aceitar o pedido de War no Anti-Entrosa.")
        end

    elseif action == "go" then
        -- Verifica se a Guild do jogador está no Anti Entrosa
        local arenaId = AntiEntrosa:getWarIdByGuild(playerGuild)
        if not arenaId then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Sua Guild não está em War no Anti-Entrosa neste momento.")
            return true
        end

        AntiEntrosa:enterPlayer(cid, arenaId)
    elseif action == "exit" then
        if not getTilePzInfo(getPlayerPosition(cid)) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você precisa estar em PZ para sair do Anti-Entrosa.")
            return true
        end
        
        if isPlayerPzLocked(cid) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você não pode sair do Anti-Entrosa com PZ Locked.")
            return true
        end
        
        local warInfo = AntiEntrosa:warInfo(playerGuild)
        if not warInfo then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Sua Guild não está em nenhuma War no momento.")
            return true
        end
        
        if getPlayerStorageValue(cid, STORAGE_PLAYER_IN_ARENA) == 1 then
            AntiEntrosa:removePlayersOutside(cid, "Você saiu do Anti Entrosa", true)
        else
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "[War Anti-Entrosa] Você não está no Anti Entrosa.")
        end
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "[War Anti-Entrosa] Digite o comando corretamente: !citywar invite, cidade, tempo, levelMax, ueMode, runesMode, ssaMode, summonsMode, playersDentro, GuildContra")
    end

    return true
end

 

Desde já obrigado pela atenção.

 

Att,

Link para o post
Compartilhar em outros sites

Troquei a minha anti-entrosa, não sei como encerrar o tópico, acredito que seja algum adm do  site?

Poderia encerrar este topico.

 

Obg

Link para o post
Compartilhar em outros sites
  • Naze locked this tópico
Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.


  • Conteúdo Similar

    • Por FeK
      CSTibia (beta) | 01/03 às 16:00

      CSTibia é um jogo PvP que conecta Counter Strike e Tibia, proporcionando uma experiência única para aqueles que gostam de PvP.

      São 2 modos de jogo, 6 mapas e mais de 50 armas disponíveis para jogar!

      #Modos de jogo: Mata-mata e Torneio x1.

      #Mapas: Dust2, Inferno, Mirage, India, IceWorld e PoolDay.

      O beta estará disponível a partir do dia 01/03 às 16 horas! Ele terá duração de 1 mês e no dia 01/04 iniciará a Session 1.

      #Download: 01/03 às 12 horas.

      ▶️ Crie já sua conta!
      http://www.cstibia.com

      🎮 Discord: https://discord.gg/zdxdTTURpq

      📸 Instagram: https://www.instagram.com/cstibia
    • Por pushwar
      IP: push-war.servegame.com | VERSÃO: 8.60
      SITE: http://push-war.servegame.com/
      Abertura dia 12/02 às 19:30
      World Type: HardCore-PvP
       Start Level: 1,000.
       Max Level: 2,050.
       
      Sistema de Level por Morte:
       Players Premium account se morrerem no Level: 2,000+ voltam para o Level: 1,500.
       Players Free account se morrerem no Level: 2,000+ voltam para o Level: 1,300.
       
      Mapa X-dream Reformulado.
       Contem 7+ cidades, que a cada 20 minutos são trocadas automaticamente.
       Sistema de TEAM-WAR(guerra entre equipes).
       
      Super Fast Atk.
       Armas e Sets editados.
       Dodge System
       
      Skull System - YellowSkull = 100 frags; GreenSkull= 250 frags; WhiteSkull = 500 frags; RedSkull= 1500 frags; BlackSkull = 3000 frags.
       
      Vocations = Warlock, Hunter e Berserker(balanceadas)
       
      Ao morrer não perde skills/items/skull.
       
      Cast system.
       
      OTserver ONLINE 24/7.
       
      Um ótimo jogo à todos, por ADM Biinhow!!!
    • Por Anderson Sacani
      Estou criando um servidor com base nos scripts de TFS 1.x e voltado ao público da america latina por causa do baixo ping na VPS... Argentina, Bolívia, Brasil, Chile, entre outros, portanto sei que falamos em português e nossos vizinhos em espanhol.
      Todos os sistemas do meu servidor são pensados para terem traduções e venho por meio deste tópico compartilhar à vocês algumas dessas funções:
       
      Antes de qualquer coisa, você precisará adicionar a seguinte variável em alguma biblioteca:
      USER_LANGUAGE = 1022118443  
      Agora que adicionou essa variável em alguma biblioteca, poderá adicionar as seguintes funções na mesma biblioteca, porém a baixo da variável USER_LANGUAGE.
       
      A primeira função serve para retornar qual idioma o player está usando:
      --[[ getLanguage, how to use: player:getLanguage() ]] function Player.getLanguage(self) if self:isPlayer() then if self:getStorageValue(USER_LANGUAGE) < 1 then return "portuguese" else return "spanish" end else print("getLanguage: Only works on players..") end end Um exemplo de como usar: player:getLanguage()
       
      A segunda função serve para alterar o idioma do player. O ideal é que seja usada na primeira vez em que o player loga no servidor:
      --[[ setLanguage, how to use: player:setLanguage("portuguese") ]] function Player.setLanguage(self, language) local value = 0 if self:isPlayer() then if language == "portuguese" then value = 0 elseif language == "spanish" then value = 1 else print("setLanguage: Only two options available. Choose one of them: 'portuguese' or 'spanish'.") end return self:setStorageValue(USER_LANGUAGE, value) else print("setLanguage: Only works on players..") end end Exemplos de como usar:
      player:setLanguage("portuguese")
      ou
      player:setLanguage("spanish")
       
      A terceira e não menos importante função, serve para mandar uma mensagem de texto ao jogador, porém ele receberá no idioma em que escolheu:
      --[[ sendLanguageTextMessage, how to use: local portugueseMessage = "Ola, tudo bom? Isto aqui é um algoritmo!" local spanishMessage = "Hola todo bien? Esto de aqui es un algoritmo!" player:sendLanguageTextMessage(MESSAGE_EVENT_ADVANCE, portugueseMessage,spanishMessage) ]] function Player.sendLanguageTextMessage(self, type, portugueseMessage, spanishMessage) if self:isPlayer() then if self:getStorageValue(USER_LANGUAGE) < 1 then return self:sendTextMessage(type, portugueseMessage) else return self:sendTextMessage(type, spanishMessage) end else print("sendLanguageTextMessage: Only works on players..") end end Um exemplo de como usar:
      player:sendLanguageTextMessage(MESSAGE_EVENT_ADVANCE, portugueseMessage, spanishMessage)
      O primeiro parâmetro é o tipo de mensagem, o segundo parâmetro será a mensagem em português e o terceiro parâmetro será em espanhol.
    • Por danielsort
      A minha poke ball nao esta funcionando como contador aonde consigo ageitar isso?
       
       

    • Por yurikil
      Saudações a todos, venho por meio deste tópico pedir uma ajuda no qual estou tentando fazer a muito tempo. Já vi alguns post aqui mesmo no TK, mas nenhum eu tive êxito. Por isso venho pedir um socorro de como eu consigo aumentar a quantidade de MagicEffects acima de 255 no meu NewClient OTC? Se alguém puder fortalecer ficarei muito grato!!
×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo