Garry's Mod

Garry's Mod

Playable Piano
FIX for conflicting hooks by Playable Piano
The Playable Piano embeds a "quick fix", which is more of a quick joke than a fix.
Add this code as a Lua autorun server file, it will solve the conflicts with the events CanPlayerEnterVehicle and PlayerUse.
hook.Add( "PostGamemodeLoaded", "playable_piano_fix", function() -- Playable Piano local CanPlayerEnterVehicle = hook.GetTable()["CanPlayerEnterVehicle"] if CanPlayerEnterVehicle then local InstrumentChairHook = CanPlayerEnterVehicle["InstrumentChairHook"] if InstrumentChairHook then local old_InstrumentChairHook = InstrumentChairHook InstrumentChairHook = function( ply, seat ) local inst = seat:GetOwner() if IsValid( inst ) and inst.Base == "gmt_instrument_base" then return old_InstrumentChairHook( ply, seat ) end end hook.Add( "CanPlayerEnterVehicle", "InstrumentChairHook", InstrumentChairHook ) end end local PlayerUse = hook.GetTable()["PlayerUse"] if PlayerUse then local InstrumentChairModelHook = PlayerUse["InstrumentChairModelHook"] if InstrumentChairModelHook then local old_InstrumentChairModelHook = InstrumentChairModelHook InstrumentChairModelHook = function( ply, seat ) local inst = seat:GetOwner() if IsValid( inst ) and inst.Base == "gmt_instrument_base" then return old_InstrumentChairModelHook( ply, seat ) end end hook.Add( "PlayerUse", "InstrumentChairModelHook", InstrumentChairModelHook ) end end end )
Last edited by Cédric GÉRILLE [GiletJaune]; Jan 12, 2022 @ 9:39am