• 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] Simple Issue

Siegh

Thronar Developer
Joined
Mar 12, 2011
Messages
1,186
Solutions
1
Reaction score
510
Location
Brazil
Hello, I'm having a supposedly very simple issue. What I need basically is to check if the player's equipped weapon corresponds to a list of ids. I'm adding these to the global.lua so I can utilize in multiple scripts easier. The problem is it's returning as false even when I clearly wield an weapon which id is included.

What I have so far is:

Global.lua
Code:
meleeCheck = {2406, 2388, 2376, 2385, 2384, 2397, 2419, 7385, 7383, 2413, 2377, 7406, 2422, 2417, 2439, 2423, 2394, 2434, 7437, 2424, 7452, 7392, 2452, 2380, 2386, 2441, 2428, 2430, 8601, 3962, 2435, 2387, 7380, 7436, 7379, 2389, 7378, 3965, 3964, 2425, 2414, 2379, 2404, 2402, 2351, 8602, 7404, 7408, 2381, 2426, 2429, 2427, 11323, 11305}

And a spell script including:

spell.lua
Code:
melee = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
if melee == meleeCheck then

If someone can enlighten me on how to solve this I'd be very happy!
Thanks in advance.
 
Hello, I'm having a supposedly very simple issue. What I need basically is to check if the player's equipped weapon corresponds to a list of ids. I'm adding these to the global.lua so I can utilize in multiple scripts easier. The problem is it's returning as false even when I clearly wield an weapon which id is included.

What I have so far is:

Global.lua
Code:
meleeCheck = {2406, 2388, 2376, 2385, 2384, 2397, 2419, 7385, 7383, 2413, 2377, 7406, 2422, 2417, 2439, 2423, 2394, 2434, 7437, 2424, 7452, 7392, 2452, 2380, 2386, 2441, 2428, 2430, 8601, 3962, 2435, 2387, 7380, 7436, 7379, 2389, 7378, 3965, 3964, 2425, 2414, 2379, 2404, 2402, 2351, 8602, 7404, 7408, 2381, 2426, 2429, 2427, 11323, 11305}

And a spell script including:

spell.lua
Code:
melee = getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid
if melee == meleeCheck then

If someone can enlighten me on how to solve this I'd be very happy!
Thanks in advance.
Lua:
local melee = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
if melee and isInArray(meleeCheck, melee.itemid) then
 
Back
Top Bottom