This is randomly happening to my players. I don't really know why :S
[code] [ERROR] gamemodes/darkrp/gamemode/cl_init.lua:325: bad argument #1 to 'Entity' (number expected, got string)
1. Entity - [C]:-1
2. Function - gamemodes/darkrp/gamemode/cl_init.lua:325
3. unknown - lua/includes/modules/usermessage.lua:87
[/code]
Post your darkrp/gamemode/cl_init.lua file
I didn't edit it but eh
[code]GM.Version = "2.4.3"
GM.Name = "DarkRP"
GM.Author = "By Rickster, Updated: Pcwizdan, Sibre, philxyz, [GNC] Matt, Chrome Bolt, FPtje Falco, Eusion, Drakehawke"
DeriveGamemode("sandbox")
util.PrecacheSound("earthquake.mp3")
/*---------------------------------------------------------------------------
Names
---------------------------------------------------------------------------*/
-- Make sure the client sees the RP name where they expect to see the name
local pmeta = FindMetaTable("Player")
pmeta.SteamName = pmeta.SteamName or pmeta.Name
function pmeta:Name()
return GAMEMODE.Config.allowrpnames and self.DarkRPVars and self:getDarkRPVar("rpname")
or self:SteamName()
end
pmeta.GetName = pmeta.Name
pmeta.Nick = pmeta.Name
-- End
function GM:DrawDeathNotice(x, y)
if not GAMEMODE.Config.showdeaths then return end
self.BaseClass:DrawDeathNotice(x, y)
end
local function DisplayNotify(msg)
local txt = msg:ReadString()
GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
surface.PlaySound("buttons/lightswitch2.wav")
-- Log to client console
print(txt)
end
usermessage.Hook("_Notify", DisplayNotify)
local function LoadModules()
local root = GM.FolderName.."/gamemode/modules/"
local _, folders = file.Find(root.."*", "LUA")
for _, folder in SortedPairs(folders, true) do
if GM.Config.DisabledModules[folder] then continue end
for _, File in SortedPairs(file.Find(root .. folder .."/sh_*.lua", "LUA"), true) do
if File == "sh_interface.lua" then continue end
include(root.. folder .. "/" ..File)
end
for _, File in SortedPairs(file.Find(root .. folder .."/cl_*.lua", "LUA"), true) do
if File == "cl_interface.lua" then continue end
include(root.. folder .. "/" ..File)
end
end
end
GM.Config = {} -- config table
include("config.lua")
include("sh_interfaceloader.lua")
include("client/help.lua")
include("client/cl_chatlisteners.lua")
include("client/DRPDermaSkin.lua")
include("client/helpvgui.lua")
include("client/hud.lua")
include("client/showteamtabs.lua")
include("client/vgui.lua")
include("shared/player_class.lua")
include("shared/animations.lua")
include("shared/commands.lua")
include("shared/entity.lua")
include("shared/MakeThings.lua")
include("shared/Workarounds.lua")
include("shared.lua")
include("addentities.lua")
include("ammotypes.lua")
include("fpp/sh_settings.lua")
include("fpp/client/FPP_Menu.lua")
include("fpp/client/FPP_HUD.lua")
include("fpp/client/FPP_Buddies.lua")
include("fpp/sh_CPPI.lua")
LoadModules()
DarkRP.finish()
surface.CreateFont("AckBarWriting", {
size = 20,
weight = 500,
antialias = true,
shadow = false,
font = "akbar"})
-- Copy from FESP(made by FPtje Falco)
-- This is no stealing since I made FESP myself.
local vector = FindMetaTable("Vector")
function vector:RPIsInSight(v, ply)
ply = ply or LocalPlayer()
local trace = {}
trace.start = ply:EyePos()
trace.endpos = self
trace.filter = v
trace.mask = -1
local TheTrace = util.TraceLine(trace)
if TheTrace.Hit then
return false, TheTrace.HitPos
else
return true, TheTrace.HitPos
end
end
function GM:HUDShouldDraw(name)
if name == "CHudHealth" or
name == "CHudBattery" or
name == "CHudSuitPower" or
(HelpToggled and name == "CHudChat") then
return false
else
return true
end
end
function GM:HUDDrawTargetID()
return false
end
function GM: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
local GUIToggled = false
local HelpToggled = false
local HelpVGUI
function GM:ShowHelp()
if not HelpVGUI then
HelpVGUI = vgui.Create("HelpVGUI")
end
HelpToggled = not HelpToggled
HelpVGUI.HelpX = HelpVGUI.StartHelpX
HelpVGUI:FillHelpInfo()
HelpVGUI:SetVisible(HelpToggled)
gui.EnableScreenClicker(HelpToggled)
end
local mouseX, mouseY = ScrW() / 2, ScrH() / 2
function GM:ShowSpare1()
GUIToggled = not GUIToggled
if GUIToggled then
gui.SetMousePos(mouseX, mouseY)
else
mouseX, mouseY = gui.MousePos()
end
gui.EnableScreenClicker(GUIToggled)
end
local function blackScreen(um)
local toggle = um:ReadBool()
if toggle then
local black = Color(0, 0, 0)
local w, h = ScrW(), ScrH()
hook.Add("HUDPaintBackground", "BlackScreen", function()
surface.SetDrawColor(black)
surface.DrawRect(0, 0, w, h)
end)
else
hook.Remove("HUDPaintBackground", "BlackScreen")
end
end
usermessage.Hook("blackScreen", blackScreen)
function GM:PlayerStartVoice(ply)
if ply == LocalPlayer() then
ply.DRPIsTalking = true
return -- Not the original rectangle for yourself! ugh!
end
self.BaseClass:PlayerStartVoice(ply)
end
function GM:PlayerEndVoice(ply)
if ply == LocalPlayer() then
ply.DRPIsTalking = false
return
end
self.BaseClass:PlayerEndVoice(ply)
end
function GM:OnPlayerChat()
end
local FKeyBinds = {
["gm_showhelp"] = "ShowHelp",
["gm_showteam"] = "ShowTeam",
["gm_showspare1"] = "ShowSpare1",
["gm_showspare2"] = "ShowSpare2"
}
function GM:PlayerBindPress(ply, bind, pressed)
self.BaseClass:PlayerBindPress(ply, bind, pressed)
if ply == LocalPlayer() and IsValid(ply:GetActiveWeapon()) and string.find(string.lower(bind), "attack2") and ply:GetActiveWeapon():GetClass() == "weapon_bugbait" then
LocalPlayer():ConCommand("_hobo_emitsound")
end
local bnd = string.match(string.lower(bind), "gm_[a-z]+[12]?")
if bnd and FKeyBinds[bnd] and GAMEMODE[FKeyBinds[bnd]] then
GAMEMODE[FKeyBinds[bnd]](GAMEMODE)
end
return
end
local function AddToChat(msg)
local col1 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local prefixText = msg:ReadString()
local ply = msg:ReadEntity()
ply = IsValid(ply) and ply or LocalPlayer()
if prefixText == "" or not prefixText then
prefixText = ply:Nick()
prefixText = prefixText ~= "" and prefixText or ply:SteamName()
end
local col2 = Color(msg:ReadShort(), msg:ReadShort(), msg:ReadShort())
local text = msg:ReadString()
local shouldShow
if text and text ~= "" then
if IsValid(ply) then
shouldShow = hook.Call("OnPlayerChat", nil, ply, text, false, not ply:Alive(), prefixText, col1, col2)
end
if shouldShow ~= true then
chat.AddText(col1, prefixText, col2, ": "..text)
end
else
shouldShow = hook.Call("ChatText", nil, "0", prefixText, prefixText, "none")
if shouldShow ~= true then
chat.AddText(col1, prefixText)
end
end
chat.PlaySound()
end
usermessage.Hook("DarkRP_Chat", AddToChat)
local function GetAvailableVehicles()
print("Available vehicles for custom vehicles:")
for k,v in pairs(DarkRP.getAvailableVehicles()) do
print("\""..k.."\"")
end
end
concommand.Add("rp_getvehicles", GetAvailableVehicles)
local function AdminLog(um)
local colour = Color(um:ReadShort(), um:ReadShort(), um:ReadShort())
local text = um:ReadString() .. "\n"
MsgC(Color(255,0,0), "[DarkRP] ")
MsgC(colour, text)
end
usermessage.Hook("DRPLogMsg", AdminLog)
local function RetrieveDoorData(len)
local door = net.ReadEntity()
local doorData = net.ReadTable()
if not door or not door.IsValid or not IsValid(door) or not doorData then return end
if doorData.TeamOwn then
local tdata = {}
for k, v in pairs(string.Explode("\n", doorData.TeamOwn or "")) do
if v and v != "" then
tdata[tonumber(v)] = true
end
end
doorData.TeamOwn = tdata
else
doorData.TeamOwn = nil
end
door.DoorData = doorData
end
net.Receive("DarkRP_DoorData", RetrieveDoorData)
local function UpdateDoorData(um)
local door = um:ReadEntity()
Sorry, you need to Log In to post a reply to this thread.