Escorted Players Going Through Walls

I am using a Police job where the Police/Civilians can escort people with a command. Now the thing is whenever a person is escorted, everything works fine. He gets attached to the officer and/or civilian who used the Escort command.

But when we move with the escorted person and get near a wall or a wired wall like we have in Jail area. The escorted person can go through the other side…like a noclip glitch. Don’t know exactly what I am doing wrong… Any idea how to fix?

Here is the code snippet.

 if not isEscorted then
                isEscorted = true
                draggerId = playerId
                local dragger = GetPlayerPed(GetPlayerFromServerId(playerId))
                local heading = GetEntityHeading(dragger)
                SetEntityCoords(GetPlayerPed(-1), GetOffsetFromEntityInWorldCoords(dragger, 0.0, 0.45, 0.0))
                AttachEntityToEntity(GetPlayerPed(-1), dragger, 11816, 0.45, 0.45, 0.0, 0.0, 0.0, 0.0, false, false, false, false, 2, true)
            else
                isEscorted = false
                DetachEntity(GetPlayerPed(-1), true, false)
            end

Here are the screenshots

On the native AttachEntityToEntity there is a way to turn collision off or on, probably you have it disabled.

But probably that is the best way as i assume enabled collision would cause more damage (pushing objects and cars with “escorting” player and so on)

2 Likes

Thanks for the response, I better removed the feature from Civilians. Only Police can now use this.

Owwe nice