Darkrp - Lua Errors

im gettting these errors for some reason that i have never gotten they have just shown up

[ERROR] gamemodes/darkrp/gamemode/libraries/fn.lua:24: not a function

  1. error - [C]:-1
  2. Flip - gamemodes/darkrp/gamemode/libraries/fn.lua:24
    3. declareTeamCommands - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:85
    4. unknown - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:448

and when i try to use the keys this.

[ERROR] gamemodes/darkrp/entities/weapons/keys/cl_menu.lua:168: attempt to call method ‘HasDarkRPPrivilege’ (a nil value)

  1. Function - gamemodes/darkrp/entities/weapons/keys/cl_menu.lua:168
  2. unknown - lua/includes/modules/usermessage.lua:87

Are you using the latest version of DarkRP? You could try reinstalling it, if the error still appears I will need to know what’s on line 24 of fn.lua

Did you go and rename references of hasDarkRPPrivilege to HasDarkRPPrivlege (uppercase H) or something? Nowhere in DarkRP calls HasDarkRPPrivilege by default.

[editline]14th May 2014[/editline]

The first error is the same. fn.Flip should be getting hasDarkRPPrivilege but it looks like you renamed it to HasDarkRPPrivilege.

I did change the hasDarkRPPrivilege to HasDarkRPPrivlege to see if that would work but before that i still got the error even with a lower case

Edit : i will change it back

Change it all back and give us what the errors are. They are very likely not the same errors.

nope still getting the same errors

[ERROR] gamemodes/darkrp/gamemode/libraries/fn.lua:24: not a function

  1. error - [C]:-1
  2. Flip - gamemodes/darkrp/gamemode/libraries/fn.lua:24
    3. declareTeamCommands - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:85
    4. unknown - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:448

[ERROR] gamemodes/darkrp/entities/weapons/keys/cl_menu.lua:168: attempt to call method ‘hasDarkRPPrivilege’ (a nil value)

  1. Function - gamemodes/darkrp/entities/weapons/keys/cl_menu.lua:168
  2. unknown - lua/includes/modules/usermessage.lua:87

[editline]14th May 2014[/editline]

Yes i think i am using the latest. is the latest 2.5.1

Okay, keep it as the lowercase H. It’s what it should be. Looks like you did something to the original function. Could you post the contents of darkrp/gamemode/modules/base/sh_util.lua?

Sure here


-----------------------------------------------------------------------------[[
/*---------------------------------------------------------------------------
Utility functions
---------------------------------------------------------------------------*/
-----------------------------------------------------------------------------]]

local vector = FindMetaTable("Vector")
local meta = FindMetaTable("Player")
local config = GM.Config

/*---------------------------------------------------------------------------
Decides whether the vector could be seen by the player if they were to look at it
---------------------------------------------------------------------------*/
function vector:isInSight(filter, ply)
	ply = ply or LocalPlayer()
	local trace = {}
	trace.start = ply:EyePos()
	trace.endpos = self
	trace.filter = filter
	trace.mask = -1
	local TheTrace = util.TraceLine(trace)

	return not TheTrace.Hit, TheTrace.HitPos
end

/*---------------------------------------------------------------------------
Turn a money amount into a pretty string
---------------------------------------------------------------------------*/
local function attachCurrency(str)
	return config.currencyLeft and config.currency .. str or str .. config.currency
end

function DarkRP.formatMoney(n)
	if not n then return attachCurrency("0") end

	if n >= 1e14 then return attachCurrency(tostring(n)) end

	n = tostring(n)
	local sep = sep or ","
	local dp = string.find(n, "%.") or #n+1

	for i=dp-4, 1, -3 do
		n = n:sub(1, i) .. sep .. n:sub(i+1)
	end

	return attachCurrency(n)
end

/*---------------------------------------------------------------------------
Find a player based on given information
---------------------------------------------------------------------------*/
function DarkRP.findPlayer(info)
	if not info or info == "" then return nil end
	local pls = player.GetAll()

	for k = 1, #pls do -- Proven to be faster than pairs loop.
		local v = pls[k]
		if tonumber(info) == v:UserID() then
			return v
		end

		if info == v:SteamID() then
			return v
		end

		if string.find(string.lower(v:SteamName()), string.lower(tostring(info)), 1, true) ~= nil then
			return v
		end

		if string.find(string.lower(v:Name()), string.lower(tostring(info)), 1, true) ~= nil then
			return v
		end
	end
	return nil
end

/*---------------------------------------------------------------------------
Find multiple players based on a string criterium
Taken from FAdmin
---------------------------------------------------------------------------*/
function DarkRP.findPlayers(info)
	if not info then return nil end
	local pls = player.GetAll()
	local found = {}
	local players

	if string.lower(info) == "*" or string.lower(info) == "<all>" then return pls end

	local InfoPlayers = {}
	for A in string.gmatch(info..";", "([a-zA-Z0-9:_.]*)[;(,%s)%c]") do
		if A ~= "" then table.insert(InfoPlayers, A) end
	end

	for _, PlayerInfo in pairs(InfoPlayers) do
		-- Playerinfo is always to be treated as UserID when it's a number
		-- otherwise people with numbers in their names could get confused with UserID's of other players
		if tonumber(PlayerInfo) then
			if IsValid(Player(PlayerInfo)) and not found[Player(PlayerInfo)] then
				found[Player(PlayerInfo)] = true
				players = players or {}
				table.insert(players, Player(PlayerInfo))
			end
			continue
		end

		for k, v in pairs(pls) do
			-- Prevend duplicates
			if found[v] then continue end

			-- Find by Steam ID
			if (PlayerInfo == v:SteamID() or v:SteamID() == "UNKNOWN") or
			-- Find by Partial Nick
			string.find(string.lower(v:Name()), string.lower(tostring(PlayerInfo)), 1, true) ~= nil or
			-- Find by steam name
			(v.SteamName and string.find(string.lower(v:SteamName()), string.lower(tostring(PlayerInfo)), 1, true) ~= nil) then
				found[v] = true
				players = players or {}
				table.insert(players, v)
			end
		end
	end

	return players
end

function meta:getEyeSightHitEntity(searchDistance, hitDistance, filter)
	searchDistance = searchDistance or 100
	hitDistance = hitDistance or 15
	filter = filter or function(p) return p:IsPlayer() and p ~= self end

	local shootPos = self:GetShootPos()
	local entities = ents.FindInSphere(shootPos, searchDistance)
	local aimvec = self:GetAimVector()
	local eyeVector = shootPos + aimvec * searchDistance

	local smallestDistance = math.huge
	local foundEnt

	for k, ent in pairs(entities) do
		if not IsValid(ent) or filter(ent) == false then continue end

		local center = ent:GetPos()
		center.z = eyeVector.z

		-- project the center vector on the aim vector
		local projected = shootPos + (center - shootPos):Dot(aimvec) * aimvec

		-- the point on the model that has the smallest distance to your line of sight
		local nearestPoint = ent:NearestPoint(projected)
		local distance = nearestPoint:Distance(projected)

		if distance < smallestDistance then
			local trace = {
				start = self:GetShootPos(),
				endpos = nearestPoint,
				filter = {self, ent}
			}
			local traceLine = util.TraceLine(trace)
			if traceLine.Hit then continue end

			smallestDistance = distance
			foundEnt = ent
		end
	end

	if smallestDistance < hitDistance then
		return foundEnt, smallestDistance
	end

	return nil
end

/*---------------------------------------------------------------------------
Print the currently available vehicles
---------------------------------------------------------------------------*/
local function GetAvailableVehicles(ply)
	if SERVER and IsValid(ply) and not ply:IsAdmin() then return end
	local print = SERVER and ServerLog or Msg

	print(DarkRP.getPhrase("rp_getvehicles") .. "
")
	for k,v in pairs(DarkRP.getAvailableVehicles()) do
		print("\""..k.."\"" .. "
")
	end
end
if SERVER then
	concommand.Add("rp_getvehicles_sv", GetAvailableVehicles)
else
	concommand.Add("rp_getvehicles", GetAvailableVehicles)
end

/*---------------------------------------------------------------------------
Whether a player has a DarkRP privilege
---------------------------------------------------------------------------*/
function meta:hasDarkRPPrivilege(priv)
	if FAdmin then
		return FAdmin.Access.PlayerHasPrivilege(self, priv)
	end
	return self:IsAdmin()
end
<<<<<<< .mine
=======

/*---------------------------------------------------------------------------
Convenience function to return the players sorted by name
---------------------------------------------------------------------------*/
function DarkRP.nickSortedPlayers()
	local plys = player.GetAll()
	table.sort(plys, function(a,b) return a:Nick() < b:Nick() end)
	return plys
end
>>>>>>> .r4204

Ah, an SVN conflict. Luckily this is a simple one.

Near the bottom remove these lines:



<<<<<<< .mine
=======


and at the last line remove:



>>>>>>> .r4204


Thanks so much you have fixed the keys error and got them working but i still get this





[ERROR] gamemodes/darkrp/gamemode/libraries/fn.lua:24: not a function
  1. error - [C]:-1
   2. Flip - gamemodes/darkrp/gamemode/libraries/fn.lua:24
    3. unknown - gamemodes/darkrp/gamemode/modules/doorsystem/sh_doors.lua:142
     4. include - [C]:-1
      5. LoadModules - gamemodes/darkrp/gamemode/cl_init.lua:16
       6. unknown - gamemodes/darkrp/gamemode/cl_init.lua:34


but im wondering why am i only getting this now i have never had any errors before as in yesterday
it only happend today`

Edit: im now getting this



[ERROR] gamemodes/darkrp/gamemode/modules/base/sh_interface.lua:22: unexpected symbol near '<'
  1. unknown - gamemodes/darkrp/gamemode/modules/base/sh_interface.lua:0


Edit Again: i have managed to fix it using bo98 it had the same >>>>>>> .r4204 in sh_interface.lua:0