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


Author Topic: DeletePersistentEntity not work  (Read 1162 times)

0 Members and 1 Guest are viewing this topic.

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
DeletePersistentEntity not work
« on: April 12, 2022, 10:34:43 PM »
Code: [Select]
FPS6 = function()
 
  while true do
   
    local HX, HY, HZ = PedGetHeadPos(gPlayer)
    local Heading = PedGetHeading(gPlayer)
    local DeltaX = -math.sin(Heading)
    local DeltaY = math.cos(Heading)
    if math.deg(Heading) > 0 then
      Rotation = math.deg(Heading) - 180
    else
      Rotation = math.deg(Heading) + 179.99
    end
    Qiang = CreatePersistentEntity("WPCannon", HX + DeltaX, HY + DeltaY, HZ - 0.5, Rotation, AreaGetVisible())
   
    DeletePersistentEntity(Qiang)
   
    Wait(0)
  end
 
end
Why DeletePersistentEntity(Qiang) not work, it will be a lot of cannon and game crash

Offline RBS ID

  • Jr. Member
  • **
  • Posts: 67
  • Gender: Male
  • I don't know.
    • View Profile
    • This is website title.
Re: DeletePersistentEntity not work
« Reply #1 on: April 13, 2022, 01:44:42 AM »
CreatePersistentEntity  returns 2 value, the object index & the object itself/type/geometry(or something like that), so it must have 2 variable that assign to this function, example:
    local objIdx, obj = CreatePersistentEntity(bla, bla, ...)

DeletePersistentEntity  also takes 2 arguments, example:
    DeletePersistentEntity(objIdx, obj)

You can see the usage of those functions in decompiled 1_06_01.lur.
« Last Edit: April 13, 2022, 01:54:09 AM by RanggaBS »

Offline Ming

  • Full Member
  • ***
  • Posts: 154
  • Gender: Male
  • 抽刀斷水水更流,舉杯消愁愁更愁
    • View Profile
Re: DeletePersistentEntity not work
« Reply #2 on: April 13, 2022, 02:43:13 AM »
CreatePersistentEntity  returns 2 value, the object index & the object itself/type/geometry(or something like that), so it must have 2 variable that assign to this function, example:
    local objIdx, obj = CreatePersistentEntity(bla, bla, ...)

DeletePersistentEntity  also takes 2 arguments, example:
    DeletePersistentEntity(objIdx, obj)

You can see the usage of those functions in decompiled 1_06_01.lur.
Get it !