• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua slot ammo

Lurk

Active Member
Joined
Dec 4, 2017
Messages
336
Reaction score
49
Hello, I have this scripts
LUA:
function onLogin(cid)
    if getPlayerStorageValue(cid, 25951) == 2 and getPlayerSlotItem(cid, CONST_SLOT_AMMO) == 12567 then
        return efeitosAura2(1,1180/8,cid)
    else
        setPlayerStorageValue(cid, 25951, -1)
    end
    return TRUE
end
when the player has that storage vallue AND a certain item in the ammo slot, efeitosAura2 should be triggered, but it isn't being triggered.
in my lib/constant I have the following
LUA:
CONST_SLOT_AMMO = 10
any ideas?
 
What is this? efeitosAura2
Post the full script please or post more details of what this script supposed to do.
 
LUA:
local aurastr = 25951 -- storage da aura
local estr = 25958 -- storage para o exhaust
local porcentagem = 35 -- chance de curar em cada volta da aura, em porcentagem
local quantheal = 84 -- porcentagem do hp máximo que cada cura irá curar. (No caso, irá curar 10% do hp máximo cada cura)
local tempo = 1180 -- tempo para dar uma volta no player (este tempo foi o que achei mais agradável visualmente, é recomendável não mudar)
local tipoaura = 35 -- tava 30 número do efeito da aura (efeito de distância, pode ser identificado com /x no jogo)
local efeitocura = 11 -- número do efeito quando a cura chega ao player (efeito de posição fixa, pode ser identificado com /z no jogo)
local espera = 2 -- segundos para usar novamente

-- Função que chama a aura
function efeitosAura2(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<=porcentagem/8 and getCreatureHealth(cid)<getCreatureMaxHealth(cid) or chances<=porcentagem/8 and getCreatureMana(cid)<getCreatureMaxMana(cid)) then
            doCreatureAddHealth(cid, getCreatureMaxHealth(cid)/quantheal)
            doCreatureAddMana(cid, getCreatureMaxMana(cid)/quantheal)
            doCreatureSay(cid, "AURA HEAL", TALKTYPE_ORANGE_1)
            if(i<=8 and i>1) then
                doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, atual, tipoaura)
            else
                doSendDistanceShoot({x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, atual, tipoaura)
            end
            doSendMagicEffect(atual, efeitocura)
        end
        if(i==8) then
            doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, {x=posaura[1].x, y=posaura[1].y, z=posaura[1].z}, tipoaura)
        elseif(i<8) then
            doSendDistanceShoot({x=posaura[i].x, y=posaura[i].y, z=posaura[i].z}, {x=posaura[i+1].x, y=posaura[i+1].y, z=posaura[i+1].z}, tipoaura)
        end
        if(i<=8 and getPlayerStorageValue(cid, aurastr)==2) then
            i = i+1
            tm = tempo/8
            return addEvent(efeitosAura2,tm,i,tm,cid)
        elseif(i>8 and getPlayerStorageValue(cid, aurastr)==2) then
            return efeitosAura2(1,0,cid)
        else
            return TRUE
        end
    else
        return TRUE
    end
end
it is an "aura" that spins around you and can heal ya (
)
and I managed to compare it right, here's the code
LUA:
function onLogin(cid)
    if getPlayerStorageValue(cid, 25951) == 2 and getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 12567 then
        return efeitosAura2(1,1180/8,cid)
    else
        setPlayerStorageValue(cid, 25951, -1)
    end
    return TRUE
end

you need this
getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid
thing. Ty for your help m0ustafa
 
Great, when there's no "Best answers" just mark it as solved, My answer isn't "Best answer" here.
 
aight, where's the "solve" button? it isn't at the top of the post

edit: oh nvm u marked that already, ty again
 
Should be on "top right" on your next threads, This thread is marked as solved.
 
Back
Top