MG_PropSave = MG_PropSave or {}

CreateConVar("mg_props_adminmode", 1, {FCVAR_NOTIFY, FCVAR_ARCHIVE})

function MG_PropSave.Save(ply, tr)
	local ent = tr.Entity
	if !IsValid(ent) or !IsEntity(ent) then return false end
	local adminmode = GetConVar("mg_props_adminmode"):GetBool()
	if adminmode and ply:IsAdmin() or !adminmode and MG_PropSave.UserGroups[ply:GetUserGroup()] then
		if CLIENT then return true end
		MG_PropSave.SaveServer(ply, tr, ent)
		return true
	else
		ply:ChatPrint("Du bist nicht zugelassen, Props zu entspeichern!")
		return false
	end
end

function MG_PropSave.UnSave(ply, tr, delete)
	local ent = tr.Entity
	if !IsValid(ent) or !IsEntity(ent) then return false end
	local adminmode = GetConVar("mg_props_adminmode"):GetBool()
	if adminmode and ply:IsAdmin() or !adminmode and MG_PropSave.UserGroups[ply:GetUserGroup()] then
		if CLIENT then return true end
		MG_PropSave.UnSaveServer(ply, tr, ent, delete)
		return true
	else
		ply:ChatPrint("Du bist nicht zugelassen, Props zu entspeichern!")
		return false
	end
end