This mod can shoot effect, but the effect can't hurt ped
Can someone help ?
EffectInFrontOfPlayer = function()
while true do
if IsButtonBeingPressed(2, 0) then
ShootEffect("CarDestroyed", 3, 0.1, 25, 100, "/Global/HitTree/Standing/PostHit/BellyDown", "Act/Anim/HitTree.act")
end
Wait(0)
end
end
ShootEffect = function(Effect, EffectSpeed, Afterimage, cdTime, Damage, Action1, Action2)
pX, pY, pZ = PedGetPosXYZ(gPlayer)
TianDiZhuZai = PedGetHeading(gPlayer)
deltaX = 0
deltaY = 0
a = 0
while a < cdTime do
a = a + 1
deltaX = deltaX + math.sin(TianDiZhuZai) * EffectSpeed
deltaY = deltaY + math.cos(TianDiZhuZai) * EffectSpeed
eX = pX - deltaX
eY = pY + deltaY
eZ = pZ
POTERS = EffectCreate(Effect, eX, eY, eZ)
for i, Ped in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
if PedIsValid(Ped) and not Ped == gPlayer and PedIsInAreaXYZ(Ped, eX, eY, eZ, 5, AreaGetVisible()) and PedGetHealth(Ped) > 0 and not PedIsPlaying(Ped, Action1, true) then
PedFaceXYZ(Ped, eX, eY, eZ)
PedApplyDamage(Ped, Damage)
PedSetActionNode(Ped, Action1, Action2)
end
end
EffectSlowKill(POTERS, Afterimage)
Wait(33)
end
end