sestorme
Member
I spent last hour looking for a solution, I checked so many different possibilities, no real effect, please look at the code, I am powerless. It's probably very easy, I just can't make it working.
It is isPlayer just for testing purposes, also [1] and [2] creature says are also for testing purposes to find out which condition isn't working. Ammo check works absolutely fine, and I would add more warnings later, like at 10/5/3/2/1 ammo left. However, for now I am struggling to detect whether weapon is actually a distance weapon, so if you guys could provide me with the right way how to detect it I'd greatly appreciate that. Thanks, rep'd.
Code:
function onAttack(cid, target)
if isPlayer(cid) == TRUE then
if isPlayer(target) == TRUE then
doCreatureSay(cid, "1.", TALKTYPE_ORANGE_1)
if (getItemWeaponType(getPlayerWeapon(cid).uid) == distance) then
local ammo = getPlayerSlotItem(cid, 10).type
doCreatureSay(cid, "2", TALKTYPE_ORANGE_1)
if ammo == 1 then
doCreatureSay(cid, "Reload.", TALKTYPE_ORANGE_1)
end
end
end
end
return TRUE
end
It is isPlayer just for testing purposes, also [1] and [2] creature says are also for testing purposes to find out which condition isn't working. Ammo check works absolutely fine, and I would add more warnings later, like at 10/5/3/2/1 ammo left. However, for now I am struggling to detect whether weapon is actually a distance weapon, so if you guys could provide me with the right way how to detect it I'd greatly appreciate that. Thanks, rep'd.