local firee = GetHashKey("WEAPON_FIREEXTINGUISHER")
local plyrx, plyry, plyrz = table.unpack(GetEntityCoords(GetPlayerPed(-1), true))
local hoserope = nil
local targetVehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
if hoserope == nil then
hoserope = AddRope(plyrx,plyry,plyrz,0.0,0.0,0.0,20.0,4,20.0,1.0,0.0,false,false,false,5.0,false,NULL)
RopeLoadTextures()
AttachRopeToEntity(hoserope,targetVehicle)
end
local spawnedRope = nil
Citizen.CreateThread(function()
while true do
if IsControlJustPressed(1, 38) then
if spawnedRope == nil then
SpawnRope()
else
RemoveRope()
end
end
Citizen.Wait(0)
end
end)
function SpawnRope()
local ped = GetPlayerPed(PlayerId())
local pedPos = GetEntityCoords(ped, false)
RopeLoadTextures()
local rope = AddRope(pedPos.x, pedPos.y, pedPos.z, 0.0, 0.0, 0.0, 10.0, 2, 10.0, 1.0, 0, 0, 0, 0, 0, 0, 0)
AttachRopeToEntity(rope, ped, pedPos.x, pedPos.y, pedPos.z, 1)
spawnedRope = rope
print("SPAWNED ROPE: " .. spawnedRope)
end
function RemoveRope()
RopeUnloadTextures()
DeleteRope(spawnedRope)
spawnedRope = nil
print("DELETED ROPE")
end