swkeep / keep-bags

A bag / backpacks script for fivem (esx,qbcore/qbox)
GNU General Public License v3.0
155 stars 37 forks source link

Collision when entering vehicle #27

Open Llama-Palooza opened 4 months ago

Llama-Palooza commented 4 months ago

Just like most weapons on back resources, back packs can sometimes cause collision issues when entering vehicles, causing it to tornado like crazy. The fix for this is simple. Add an export to remove/add bags that we can add to the event handler for entering a vehicle.

swkeep commented 4 months ago

It's technically disabled it, but I guess it's not disabled for other players

https://github.com/swkeep/keep-bags/blob/main/client/clothing.lua#L70

Llama-Palooza commented 4 months ago

It's technically disabled it, but I guess it's not disabled for other players

https://github.com/swkeep/keep-bags/blob/main/client/clothing.lua#L70

Ya, I saw that too, but it seems the collisions get enabled again sometimes. Any chance of an export to remove and add bags back that we can utilize? That way when anyone gets in a vehicle, they bags get removed and then are added again when they exit a vehicle.

swkeep commented 4 months ago

I created an active thread (aedf43bade6ca666d267014f1eb4cb8c6fd367bf) to check for vehicles, but I think I need to do more to ensure they don't spawn within that 250ms window :)

Llama-Palooza commented 4 months ago

I will add that and test. Thank you for the update.

Llama-Palooza commented 4 months ago

I created an active thread (aedf43b) to check for vehicles, but I think I need to do more to ensure they don't spawn within that 250ms window :)

So I use this event for removing weapons on players back and re-adding them, it seems to work just fine. I'm thinking this may be better to use than the while true loop, any thoughts? Obviously this is for a qb server.

EDIT This seems to be working fine for me. I'm not sure if it's better than the while true loop, but it is working and I haven't had an issue yet.


RegisterNetEvent('QBCore:Client:VehicleInfo', function(data)
    if data.event == "Entered" then
        BodyAttachment:clearAll()      
    elseif data.event == "Left" then
        Load()
    end
end)```
Llama-Palooza commented 4 months ago

I created an active thread (aedf43b) to check for vehicles, but I think I need to do more to ensure they don't spawn within that 250ms window :)

So I use this event for removing weapons on players back and re-adding them, it seems to work just fine. I'm thinking this may be better to use than the while true loop, any thoughts? Obviously this is for a qb server.

EDIT This seems to be working fine for me. I'm not sure if it's better than the while true loop, but it is working and I haven't had an issue yet.

RegisterNetEvent('QBCore:Client:VehicleInfo', function(data)
    if data.event == "Entered" then
        BodyAttachment:clearAll()      
    elseif data.event == "Left" then
        Load()
    end
end)```

This seems to work really well so far and haven't had issues as of yet.

swkeep commented 4 months ago

Thank you for the information However, my script needs to work in ESX as well, so I can't directly use it I will probably make a bridge within my Harmony to allow it to use both events https://github.com/esx-framework/esx_core/blob/c80916c3e3b14e3cfce6102801b382e59c49bd27/%5Bcore%5D/es_extended/client/modules/actions.lua#L70

Llama-Palooza commented 4 months ago

I believe there is a baseevents for entering a vehicle as well, I'll check when I get home.

On Thu, Jul 4, 2024, 3:48 AM swkeep @.***> wrote:

Thank you for the information However, my script needs to work in ESX as well, so I can't directly use it I will probably make a bridge within my Harmony to allow it to use both events

https://github.com/esx-framework/esx_core/blob/c80916c3e3b14e3cfce6102801b382e59c49bd27/%5Bcore%5D/es_extended/client/modules/actions.lua#L70

— Reply to this email directly, view it on GitHub https://github.com/swkeep/keep-bags/issues/27#issuecomment-2208331233, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5V6JSKVVLUXMYJ37LJQCW3ZKT45NAVCNFSM6AAAAABJSR2YUWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYGMZTCMRTGM . You are receiving this because you authored the thread.Message ID: @.***>