Skip to content

Commit

Permalink
chore(PHYSICS/DeleteRope): Update example based on review
Browse files Browse the repository at this point in the history
Co-authored-by: Dillon Skaggs <[email protected]>
  • Loading branch information
JayPaulinCodes and AvarianKnight authored Aug 6, 2024
1 parent 3187583 commit 51a6cad
Showing 1 changed file with 31 additions and 9 deletions.
40 changes: 31 additions & 9 deletions PHYSICS/DeleteRope.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,39 @@ You might want to check if the rope exists before with [DOES_ROPE_EXIST](#_0xFD5
## Examples
```lua
-- Create a rope and store the handle
local rope = AddRope(-2096.096436, -311.906891, 14.510918, 0.0, 0.0, 0.0, 10.0, 1, 10.0, 0.0, 1.0, false, false, false, 1.0, false, 0)
-- Check if the rope exists.
if not DoesRopeExist(rope) then
-- If the rope does not exist, end the execution of the code here.
return
local function cleanup_rope_textures()
-- we only want to cleanup if there are no other ropes still left on the map
-- otherwise we'll make them go invisible.
if #GetAllRopes() == 0 then
-- there are no ropes on the map, we're safe to unload the textures.
RopeUnloadTextures()
end
end
-- If the rope does exist, delete the rope.
DeleteRope(rope)
CreateThread(function()
-- if textures aren't loaded then we need to load them
if not RopeAreTexturesLoaded() then
-- load the textures so we can see the rope
RopeLoadTextures()
while not RopeAreTexturesLoaded() do
Wait(0)
end
end
-- Create a rope and store the handle
local rope = AddRope(-2096.096, -311.906, 14.51, 0.0, 0.0, 0.0, 10.0, 1, 10.0, 0.0, 1.0, false, false, false, 1.0, false, 0)
-- Check if the rope exists.
if not DoesRopeExist(rope) then
cleanup_rope_textures()
-- If the rope does not exist, end the execution of the code here.
return
end
-- Let the rope exist for 3 seconds
Wait(3000)
-- Delete the rope!
DeleteRope(rope)
cleanup_rope_textures()
end)
```

```cs
Expand Down

0 comments on commit 51a6cad

Please sign in to comment.