Приветствую снова. Gprotect выдает такую ошибку, не понимаю что с ним стало.
Сам код в котором возникает ошибка:
Ошибка:
[[protect] gprotect] addons/[protect] gprotect/lua/g_protect/sh_gprotect.lua:38: attempt to index a nil value
1. GetLang - addons/[protect] gprotect/lua/g_protect/sh_gprotect.lua:38
2. func - addons/[protect] gprotect/lua/g_protect/client/cl_gprotect.lua:674
3. unknown - lua/includes/modules/hook.lua:241 (x126)
Сам код в котором возникает ошибка:
сам код:
gProtect = gProtect or {}
local sidlink = {}
gProtect.GetOwner = function(ent)
if !IsValid(ent) then return end
local result = ent:GetNWString("gPOwner", "")
local foundply = player.GetBySteamID( result )
foundply = !isstring(foundply) and (IsValid(foundply) and foundply:IsPlayer() and foundply) or foundply
return (foundply and foundply) or nil
end
gProtect.HasPermission = function(ply)
local usergroup = ply:GetUserGroup()
return gProtect.config.ConfigPermission[usergroup] and gProtect.config.ConfigPermission[usergroup] or CAMI and isfunction(CAMI.PlayerHasAccess) and CAMI.PlayerHasAccess(ply, "gProtect_Settings", function() return false end) or false
end
gProtect.GetLang = function(translation, module, var1, var2, var3)
local response
if module then
if var1 then
response = gProtect.language[module][gProtect.config.SelectedLanguage] and gProtect.language[module][gProtect.config.SelectedLanguage][var1]
if !response then response = gProtect.language[module]["eng"][var1] end
if var2 then
response = gProtect.language[module] and gProtect.language[module][gProtect.config.SelectedLanguage] and gProtect.language[module][gProtect.config.SelectedLanguage][var1] and gProtect.language[module][gProtect.config.SelectedLanguage][var1][var2]
if !response then response = gProtect.language[module]["eng"][var1][var2] end
if var3 then
response = gProtect.language[module] and gProtect.language[module][gProtect.config.SelectedLanguage] and gProtect.language[module][gProtect.config.SelectedLanguage][var1] and gProtect.language[module][gProtect.config.SelectedLanguage][var1][var2] and gProtect.language[module] and gProtect.language[module][gProtect.config.SelectedLanguage] and gProtect.language[module][gProtect.config.SelectedLanguage][var1] and gProtect.language[module][gProtect.config.SelectedLanguage][var1][var2][var3]
if !response then response = gProtect.language[module]["eng"][var1][var2][var3] end
end
end
end
else
response = gProtect.language[gProtect.config.SelectedLanguage][translation]
if !response then response = gProtect.language["eng"][translation] end
end
return response
end
gProtect.HandlePermissions = function(ply, ent, permission)
if (!IsValid(ent) and !ent:IsWorld()) or ent:IsPlayer() or !IsValid(ply) or !ply:IsPlayer() then return false end
local owner = gProtect.GetOwner(ent)
local weapon = permission and permission or IsValid(ply:GetActiveWeapon()) and ply:GetActiveWeapon():GetClass() or "weapon_physgun"
local ownsid = isstring(owner) and owner or IsValid(owner) and owner:SteamID() or ""
if (ply == owner) or (gProtect.TouchPermission and gProtect.TouchPermission[ownsid] and gProtect.TouchPermission[ownsid][weapon] and !isnumber(gProtect.TouchPermission[ownsid][weapon]) and gProtect.TouchPermission[ownsid][weapon][ply:SteamID()]) then
return true
end
if owner == "World" and gProtect.TouchPermission and gProtect.TouchPermission[owner] then
local touchtbl = gProtect.TouchPermission[owner][weapon]
if !touchtbl then return false end
if touchtbl["*"] or touchtbl[ply:GetUserGroup()] then return true end
end
if ent:IsWorld() then return nil end
return false, true
end
hook.Add( "PhysgunPickup", "gP:PhysgunPickupLogic", function( ply, ent, norun )
if TCF and TCF.Config and ent:GetClass() == "cocaine_cooking_pot" and IsValid( ent:GetParent() ) then return nil end --- Compatibilty with the cocaine factory.
if ent:IsPlayer() then return nil end
if SERVER then
local servercheck = gProtect.HandlePhysgunPermission(ply, ent)
if isbool(servercheck) then return servercheck end
end
return gProtect.HandlePermissions(ply, ent, "weapon_physgun")
end )
if CAMI and isfunction(CAMI.RegisterPrivilege) then CAMI.RegisterPrivilege({Name = "gProtect_Settings", hasAccess = false, callback = function() end}) CAMI.RegisterPrivilege({Name = "gProtect_StaffNotifications", MinAccess = "admin", hasAccess = false, callback = function() end}) end