fyalhed
Member
- Joined
- Nov 18, 2017
- Messages
- 156
- Reaction score
- 20
Why this script is not recharging assassin star on hands?
This script should work like this, when you shot the last assassin star u hand on hands, it recharge with how many u have in your backpack
I've changed doPlayerAddItem(cid,assassin_stars_itemID, ammo_count)
To doPlayerAddItem(cid, 2260, ammo_count)
Blank runes (2260) just for a test, with blank runes, when you shot the last assassin star it add blank runes that u have stars in your hands
But if i change to doPlayerAddItem(cid,assassin_stars_itemID, ammo_count), sounds like script doing nothing, i think is re-adding, but still on backpack, not on hands
Anybody know how to fix this?
This script should work like this, when you shot the last assassin star u hand on hands, it recharge with how many u have in your backpack
I've changed doPlayerAddItem(cid,assassin_stars_itemID, ammo_count)
To doPlayerAddItem(cid, 2260, ammo_count)
Blank runes (2260) just for a test, with blank runes, when you shot the last assassin star it add blank runes that u have stars in your hands
But if i change to doPlayerAddItem(cid,assassin_stars_itemID, ammo_count), sounds like script doing nothing, i think is re-adding, but still on backpack, not on hands
Code:
local assassin_stars_itemID = 7368
local function refillAssassinStars(cid, ammo_count)
if isPlayer(cid) then
print(01001)
doPlayerRemoveItem(cid, assassin_stars_itemID, ammo_count)
doPlayerAddItem(cid, 2260, ammo_count)
print(01002)
print("Finished normally, ammo refilled.")
end
end
local function autoRefillAssassinStars(cid)
-- find which hand has assassin stars equipped
local hand_to_check = 0
local left_hand = getPlayerSlotItem(cid, CONST_SLOT_LEFT)
local right_hand = getPlayerSlotItem(cid, CONST_SLOT_RIGHT)
if left_hand.uid ~= 0 and left_hand.itemid == assassin_stars_itemID then
print(111)
hand_to_check = CONST_SLOT_LEFT
elseif right_hand.uid ~= 0 and right_hand.itemid == assassin_stars_itemID then
print(222)
hand_to_check = CONST_SLOT_RIGHT
else
print("ERROR -- This should be impossible to ever see.")
if left_hand.uid ~= 0 then
print("" .. left_hand.uid .. ", " .. left_hand.itemid .. "")
else
print("" .. left_hand.uid .. ", 0")
end
if right_hand.uid ~= 0 then
print("" .. right_hand.uid .. ", " .. right_hand.itemid .. "")
else
print("" .. right_hand.uid .. ", 0")
end
return false
end
print(333)
-- check if only 1 ammo left
local ammo_in_slot = getPlayerSlotItem(cid, hand_to_check).type
print(ammo_in_slot)
if ammo_in_slot ~= 1 then
print("Finished normally, ammo not refilled. (ammo in slot above 1)")
return false
end
print(444)
-- refill assassin stars
local ammo_count = getPlayerItemCount(cid, assassin_stars_itemID) - 1
print(ammo_count)
ammo_count = ammo_count >= 100 and 100 or ammo_count
print(ammo_count)
if ammo_count > 0 then
addEvent(refillAssassinStars, 1, cid, ammo_count)
else
print("Finished normally, ammo not refilled. (no ammo available for refill.)")
return false
end
return true
end
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, 18)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
function onGetFormulaValues(cid, level, skill, attack, factor)
-- get attack mode
local damagebase_min = wbdmg_distance_min
local damagebase_max = wbdmg_distance_max
if factor == 1.0 then -- player_fight_mode = offensive
damagebase_min = damagebase_min * 3
damagebase_max = damagebase_max * 3
elseif factor == 2.0 then -- player_fight_mode = defensive
damagebase_min = damagebase_min * 1
damagebase_max = damagebase_max * 1
else -- player_fight_mode = balanced
damagebase_min = damagebase_min * 2
damagebase_max = damagebase_max * 2
end
min = ((damagebase_min) * (attack * 12) * (skill * 3)) * -0.10
max = ((damagebase_max) * (attack * 12) * (skill * 3)) * -1.00
return min, max
end
setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "onGetFormulaValues")
function onUseWeapon(cid, var)
autoRefillAssassinStars(cid)
return doCombat(cid, combat, var)
end
Anybody know how to fix this?