#
Before starting
Unlike other addons, SVMod has been developed in a non-intrusive way. It will not change any of the game's default behaviours, and can be fully disabled and activated without impacting your game.
#
Is SVMod installed?
You should always check if SVMod is present before using it. Nothing tells you that SVMod is always present in the server. To check that SVMod is present, simply check that the variable SVMOD
is not nil.
if SVMOD then
-- SVMod is loaded in this game!
end
#
Is a SV Vehicle?
Whenever a vehicle appears in game, SVMod will load on it if it has data related to the vehicle model. Since not all vehicles are compatible, you should make sure that the vehicle is an SV Vehicle before using our functions.
IsVehicle returns true if the vehicle is a SV vehicle, false otherwise.
if SVMOD and SVMOD:IsVehicle(veh) then
-- You can now use our functions!
end
This function will return false if the vehicle is [NULL ENTITY]. Therefore you should not call IsValid before calling this function.
if SVMOD and IsValid(veh) and SVMOD:IsVehicle(veh) then
-- IsValid(veh) is useless as IsVehicle already does it
end
if SVMOD:IsVehicle(veh) then
-- Here you live dangerously, because nothing tells you that SVMod is installed in the game.
-- So please, always check if SVMOD variable exists!
end
Again, you MUST check that the vehicle is a SV vehicle before using our functions.