#
Hooks
NEVER return false or true if you don't need it. Otherwise, you can break other addons or even break the SVMod. More information here.
#
SVMod state
SHARED
SV_Enabled and SV_Disabled are called when respectively the addon is enabled, and the addon is disabled.
hook.Add("SV_Enabled", "UniqueNameHere", function()
-- SVMod enabled.
end)
hook.Run("SV_Disabled", "UniqueNameHere", function()
-- SVMod disabled.
end)
#
Vehicle load or unload
SHARED
SV_LoadVehicle and SV_UnloadVehicle are called when respectively a vehicle is being loaded, and a vehicle is being unloaded.
Calling SVMod functions here is very dangerous, nothing says that the vehicle is fully loaded. You should use SV_VehicleLoaded and SV_VehicleUnloaded instead.
hook.Add("SV_LoadVehicle", function(veh)
-- veh is being loaded.
-- Calling SVMod functions here is very dangerous, nothing says that the vehicle is fully loaded.
end)
hook.Add("SV_UnloadVehicle", function(veh)
-- veh is being unloaded.
-- Calling SVMod functions here is very dangerous, nothing says that the vehicle is fully loaded.
end)
SV_VehicleLoaded and SV_VehicleUnloaded are called when respectively a vehicle has been loaded, and a vehicle has been unloaded.
hook.Add("SV_VehicleLoaded", function(veh)
-- veh has been loaded.
end)
hook.Add("SV_VehicleUnloaded", function(veh)
-- veh has been unloaded.
end)
hook.Run("SV_FillerPistolRopeDestroyed", self:GetParent(), self.Player, self.Pump) hook.Run("SV_UsePetrolCanister", self, ply) hook.Run("SV_PayFuelPump", self.Player, self.Price) hook.Run("SV_ExplodedVehicle", veh) hook.Run("SV_OutOfFuel", veh) hook.Run("SV_PartRepaired", self, ply)
hook.Run("SV_PlayerEnteredVehicle", LocalPlayer(), veh) hook.Run("SV_PlayerLeaveVehicle", LocalPlayer(), veh)
hook.Run("SV_TriedToEnterLockedVehicle", self, ply) hook.Run("SV_TriedToExitLockedVehicle", self, ply)