Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lua/svmod/config/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ function SVMOD:Load()

if SERVER then
self.CFG.Others.HUDColor = Color(self.CFG.Others.HUDColor.r, self.CFG.Others.HUDColor.g, self.CFG.Others.HUDColor.b)

if SVMOD.CFG.Others.IsCarkillEnabled == nil then
SVMOD.CFG.Others.IsCarkillEnabled = true
end
elseif self.CFG.Shortcuts then
-- CLIENT
for i, s in ipairs(self.CFG.Shortcuts) do
Expand All @@ -75,7 +79,8 @@ function SVMOD:Load()
HUDPositionY = 0.92,
HUDSize = 90,
HUDColor = Color(178, 95, 245),
CustomSuspension = 0
CustomSuspension = 0,
IsCarkillEnabled = true
}
SVMOD:Save()
SVMOD:PrintConsole(SVMOD.LOG.Info, "Configuration file server-side converted from 1.3 to 1.4.")
Expand Down
3 changes: 2 additions & 1 deletion lua/svmod/config/sv_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function SVMOD:ResetConfiguration()
HUDPositionY = 0.91,
HUDSize = 100,
HUDColor = Color(178, 95, 245),
CustomSuspension = 0
CustomSuspension = 0,
IsCarkillEnabled = true
}

SVMOD.CFG.Contributor = {
Expand Down
34 changes: 34 additions & 0 deletions lua/svmod/gui/settings/cl_others.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,38 @@ function SVMOD:GUI_Others(panel, data)
slide:SetMinValue(-10)
slide:SetMaxValue(10)
slide:SetUnit("")

local title = SVMOD:CreateTitle(panel, language.GetPhrase("svmod.others.carkill"))
title:DockMargin(0, 10, 0, 0)

SVMOD:CreateSettingPanel(panel, language.GetPhrase("svmod.others.enable_carkill"), {
{
Name = language.GetPhrase("svmod.enable"),
Color = Color(59, 217, 85),
HoverColor = Color(156, 255, 161),
IsSelected = (data.IsCarkillEnabled == true),
DoClick = function()
net.Start("SV_Settings")
net.WriteString("Others")
net.WriteString("IsCarkillEnabled")
net.WriteUInt(0, 2) -- bool
net.WriteBool(true)
net.SendToServer()
end
},
{
Name = language.GetPhrase("svmod.disable"),
Color = Color(173, 48, 43),
HoverColor = Color(224, 62, 56),
IsSelected = (data.IsCarkillEnabled == false),
DoClick = function()
net.Start("SV_Settings")
net.WriteString("Others")
net.WriteString("IsCarkillEnabled")
net.WriteUInt(0, 2) -- bool
net.WriteBool(false)
net.SendToServer()
end
}
})
end
1 change: 1 addition & 0 deletions lua/svmod/gui/settings/cl_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ net.Receive("SV_Settings", function()
data.HUDSize = net.ReadUInt(9) -- max: 511
data.HUDColor = net.ReadColor()
data.CustomSuspension = math.Round(net.ReadFloat(), 2)
data.IsCarkillEnabled = net.ReadBool()

data.EnterpriseID = net.ReadFloat()
end
Expand Down
1 change: 1 addition & 0 deletions lua/svmod/gui/settings/sv_settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ concommand.Add("svmod", function(ply)
net.WriteUInt(SVMOD.CFG["Others"]["HUDSize"], 9) -- max: 511
net.WriteColor(SVMOD.CFG["Others"]["HUDColor"])
net.WriteFloat(SVMOD.CFG["Others"]["CustomSuspension"])
net.WriteBool(SVMOD.CFG["Others"]["IsCarkillEnabled"])

net.WriteFloat(SVMOD.CFG["Contributor"]["EnterpriseID"])
end
Expand Down
10 changes: 10 additions & 0 deletions lua/svmod/health/sv_health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,14 @@ hook.Add("SV_PlayerLeaveVehicle", "SV_DealDamageOnLeave", function(ply, veh)
DInfo:SetDamage(math.Round(speed / 5 * SVMOD.CFG.Damage.PlayerExitMultiplier))
DInfo:SetDamageType(DMG_VEHICLE)
ply:TakeDamageInfo(DInfo)
end)

hook.Add("EntityTakeDamage", "SV_CarKill", function(victim, dmg)
local ent = dmg:GetInflictor()

if SVMOD.CFG.Others.IsCarkillEnabled or not victim:IsPlayer() or not SVMOD:IsVehicle(ent) or not ent:SV_IsDriverSeat() then
return
end

return true
end)
2 changes: 2 additions & 0 deletions resource/localization/de/svmod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ svmod.others.hud_size=Größe
svmod.others.hud_color=Farbe
svmod.others.wheels=REIFEN
svmod.others.custom_suspension=Individuelle Federung der Fahrzeuge (0 deaktiviert)
svmod.others.carkill=CARKILL
svmod.others.enable_carkill=Enable the carkill

svmod.credits=CREDITS

Expand Down
2 changes: 2 additions & 0 deletions resource/localization/en/svmod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ svmod.others.hud_size=Size
svmod.others.hud_color=Color
svmod.others.wheels=WHEELS
svmod.others.custom_suspension=Custom suspension of the vehicles (0 disabled)
svmod.others.carkill=CARKILL
svmod.others.enable_carkill=Enable the carkill

svmod.credits=CREDITS

Expand Down
2 changes: 2 additions & 0 deletions resource/localization/fr/svmod.properties
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ svmod.others.hud_size=Taille
svmod.others.hud_color=Couleur
svmod.others.wheels=PNEUS
svmod.others.custom_suspension=Suspension des véhicules customisée (0 désactivé)
svmod.others.carkill=CARKILL
svmod.others.enable_carkill=Activer le carkill

svmod.credits=CRÉDITS

Expand Down