.
This commit is contained in:
@@ -1,17 +1,42 @@
|
||||
local ForceHostname = "FT 4.0 | ТЕСТ СЕРВЕР"
|
||||
|
||||
local function EnforceHostname()
|
||||
if GetConVar("hostname"):GetString() ~= ForceHostname then
|
||||
local hostnameCVar = GetConVar("hostname")
|
||||
if not hostnameCVar then return end
|
||||
|
||||
local current = hostnameCVar:GetString()
|
||||
if current ~= ForceHostname then
|
||||
print("[HOSTNAME FORCE] Detected name mismatch!")
|
||||
print(" Current: '" .. current .. "'")
|
||||
print(" Target: '" .. ForceHostname .. "'")
|
||||
|
||||
-- Try to set it directly and via command
|
||||
hostnameCVar:SetString(ForceHostname)
|
||||
RunConsoleCommand("hostname", ForceHostname)
|
||||
end
|
||||
end
|
||||
|
||||
hook.Add("Think", "ForceHostnameAggressive", function()
|
||||
-- Monitor for external changes
|
||||
cvars.AddChangeCallback("hostname", function(convar, old, new)
|
||||
if new ~= ForceHostname then
|
||||
print("[HOSTNAME FORCE] WRAPPER: Hostname was changed by an external source!")
|
||||
print(" From: '" .. old .. "'")
|
||||
print(" To: '" .. new .. "'")
|
||||
|
||||
timer.Simple(0.1, EnforceHostname)
|
||||
end
|
||||
end, "ForceHostnameTracker")
|
||||
|
||||
hook.Add("Initialize", "ForceHostnameInit", function()
|
||||
print("[HOSTNAME FORCE] Script initialized.")
|
||||
EnforceHostname()
|
||||
end)
|
||||
|
||||
timer.Create("ForceHostnameTimer", 0.1, 0, function()
|
||||
-- Keep it forced every 5 seconds (Think is overkill if we use callbacks)
|
||||
timer.Create("ForceHostnameTimer", 5, 0, function()
|
||||
EnforceHostname()
|
||||
end)
|
||||
|
||||
-- Run once on load
|
||||
EnforceHostname()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user