elnelson
Lunaria World Dev
hey bois, good morning, how can i avoid this script pass through walls?
its a spear active effect for tfs 0.4, but can be abused if player is between walls x.x
its a spear active effect for tfs 0.4, but can be abused if player is between walls x.x
XML:
<action itemid="2389" event="script" value="artifacts/spear.lua"/>
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, true)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_DRAWBLOOD)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_SPEAR)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)
local condition = createConditionObject(CONDITION_PHYSICAL)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 5, 1000, -5)
setCombatCondition(combat, condition)
function onUse(cid, item, fromPosition, itemEx, toPosition)
--- CONFIG ---
local chance = math.random(0,1)
local levelReq = 1 -- level required to use this effect
local exhStorage = 5452 -- storage for exhaustion between usages
local exhTime = 10 -- time of exhaustion (in seconds)
--- CONFIG ---
if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 2389 or getPlayerSlotItem(cid, CONST_SLOT_RIGHT).itemid == 2389 or getPlayerSlotItem(cid, CONST_SLOT_LEFT).itemid == 2389 then
if getPlayerLevel(cid) >= levelReq then
local tPos = getCreaturePosition(getCreatureTarget(cid))
local target = getCreatureTarget(cid)
if getCreatureTarget(cid) ~= 0 then
if getDistanceBetween(getCreaturePosition(cid), tPos) <= 3 then
if not(exhaustion.check(cid,exhStorage)) then
exhaustion.set(cid, exhStorage, exhTime)
doSendDistanceShoot(fromPosition, tPos, CONST_ANI_SPEAR)
doAddCondition(getCreatureTarget(cid), condition)
doTargetCombatHealth(0, getCreatureTarget(cid), COMBAT_PHYSICALDAMAGE, -5, -25, CONST_ME_NONE)
doSendAnimatedText(getPlayerPosition(target),"Bleeding", TEXTCOLOR_RED)
doSendMagicEffect(tPos, CONST_ME_DRAWBLOOD)
doRemoveItem(item.uid, 1)
doCreateItem(2389, chance, tPos)
doCreatureSay(cid, "Toss", 19)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to wait "..exhaustion.get(cid, exhStorage).." seconds before you can use it again.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need be closer.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need a target.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Your need level 20 to use this item.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You must equip this item first.")
end
end
Attachments
-
bug_action.png380 KB · Views: 26 · VirusTotal