• 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!

Lua Item Required to Cast Spell

Jaed Le Raep

★Gaeming★
Joined
Sep 3, 2007
Messages
1,296
Reaction score
441
Hey guys, was just wondering if i could get a little bit of support. At onCast, it's supposed to check that the player has the appropriate weapon equipped, in this case, they're in an array (because I wanted it to check for more than just one itemid). Would really appreciate someone lending me a hand and completing the template.

As it stands, it doesn't give any console errors, but the "Yay it works" message isn't popping up, meaning that the if is ringing up as false =/

Lua:
local bows = {
        bows = {2456, 8854, 8857},
}


local combat1 = createCombatObject()
setCombatParam(combat1, COMBAT_PARAM_EFFECT, 62)
 
local combat2 = createCombatObject()
setCombatParam(combat2, COMBAT_PARAM_EFFECT, 63)
 
function onCastSpell(cid, var)
local id = getPlayerSlotItem(cid, CONST_SLOT_LEFT)


        if bows[id] then
            addEvent(doCombat, 2, cid, combat1, var)
            addEvent(doPlayerSendTextMessage, 1, cid, MESSAGE_INFO_DESCR, "Yay, it works!")
        else
            addEvent(doPlayerSendTextMessage, 1, cid, MESSAGE_INFO_DESCR, "You don't have the appropriate weapon equipped.")
            addEvent(doCombat, 2, cid, combat2, var)
        end
    return true
end
 
Back
Top