News: Welcome back to Bullworth! If you haven't already, you will need to reset your password..


Author Topic: Shoot effect mod help  (Read 938 times)

0 Members and 1 Guest are viewing this topic.

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Shoot effect mod help
« on: September 26, 2021, 08:34:19 PM »
This mod can shoot effect, but the effect can't hurt ped
Can someone help ?
Code: [Select]
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