-- ============================================================ -- advancedgarages | Effets d'alpha (fondu) sur les véhicules -- ============================================================ -- Fade-out : fait disparaître progressivement un véhicule avant de l'en faire sortir le joueur. -- Si Config.SetEntityAlpha est désactivé, déclenche un fondu d'écran classique. function SaveVehicleAlpha(vehicleEntity) if not Config.SetEntityAlpha then DoScreenFadeOut(950) Wait(1000) return end if not DoesEntityExist(vehicleEntity) then return end TaskLeaveVehicle(cache.ped, vehicleEntity, 0) Wait(1250) while GetEntityAlpha(vehicleEntity) > 15 do SetEntityAlpha(vehicleEntity, GetEntityAlpha(vehicleEntity) - 5, false) Wait(0) end end -- Fade-in : fait apparaître progressivement un véhicule qui vient d'être spawné. function SpawnVehicleAlpha(vehicleEntity) if not Config.SetEntityAlpha then return end SetEntityAlpha(vehicleEntity, 0, false) Wait(150) while GetEntityAlpha(vehicleEntity) < 255 do SetEntityAlpha(vehicleEntity, GetEntityAlpha(vehicleEntity) + 5, false) Wait(0) end if GetEntityAlpha(vehicleEntity) == 255 then ResetEntityAlpha(vehicleEntity) end end -- ============================================================ -- Événement réseau : fade-in déclenché depuis le serveur -- (utilisé quand un autre joueur spawne un véhicule réseau) -- ============================================================ RegisterNetEvent("advancedgarages:client:setVehicleAlpha") AddEventHandler("advancedgarages:client:setVehicleAlpha", function(networkId) if not Config.SetEntityAlpha then return end if not NetworkDoesNetworkIdExist(networkId) then return end local vehicleEntity = NetworkGetEntityFromNetworkId(networkId) SetEntityAlpha(vehicleEntity, 0, false) Wait(150) while GetEntityAlpha(vehicleEntity) < 255 do SetEntityAlpha(vehicleEntity, GetEntityAlpha(vehicleEntity) + 3, false) Wait(0) end if GetEntityAlpha(vehicleEntity) == 255 then ResetEntityAlpha(vehicleEntity) end end)