So my developer is lost, and he does not have a facepunch account, so he asked me to post this.
He is getting this error
[code] [ERROR] gamemodes/applejack/gamemode/metatables/sv_player.lua:654: attempt to concatenate field 'MySQL Table' (a nil value)
1. LoadData - gamemodes/applejack/gamemode/metatables/sv_player.lua:654
2. unknown - gamemodes/applejack/gamemode/init.lua:672
[EV] Hook 'PlayerSpawn' in plugin 'Player Info' failed with error: [/code]
and then the code for sv_player.lua [code] --[[
~ Shared Player metatable ~
~ Applejack ~
--]]
---
-- The shared player metatable
-- @name meta
-- @class table
local meta = debug.getregistry().Player;
if (not meta) then
error("["..os.date().."] Applejack Shared Player metatable: No metatable found!");
end
---
-- A shorthand check to see if a player is a moderator or higher.
-- @return true if they are, false if not.
function meta:IsModerator()
return self:IsAdmin() or self:GetNWBool("Moderator");
end
---
-- Gets the physical ragdoll made by player:KnockOut().
-- @return A vaild entity if the player is ragdolled, NULL else.
function meta:GetRagdollEntity()
return self:GetNWEntity("Ragdoll");
end
meta.GetEntityPos = debug.getregistry().Entity.GetPos;
---
-- An override of the GetPos function in the base entity metatable.
-- Takes into account that the player may be rolling about on the floor.
-- @return The position of the player's ragdoll if valid, otherwise the position of the player's entity.
function meta:GetPos()
local ragdoll = self:GetRagdollEntity();
if IsValid(ragdoll) then
return ragdoll:GetPos();
else
return self:GetEntityPos();
end
end
---
-- Checks if the player has been ragdolled
-- @return true if they are, false if they're not.
function meta:KnockedOut()
return self:GetNWBool"KnockedOut";
end
---
-- Checks if the player has been tied up
-- @return true if they are, false if they're not.
function meta:Tied()
return self:GetNWBool"Tied";
end
---
-- Checks if the player has been arrested
-- @return true if they are, false if they're not.
function meta:Arrested()
return self:GetNWBool"Arrested";
end
---
-- Checks if the player has a warrant against him
-- @return true if they are, false if they're not.
function meta:Warranted()
return self:GetNWString("Warrant") ~= "";
end
---
-- Get's the warrant against the player
-- @return The warrant name or ""
function meta:GetWarrant()
return self:GetNWString("Warrant");
end [/code]
and the Init.lua
[code] --[[
Name: "init.lua".
~ Applejack ~
--]]
--
require"mysqloo"
-- Include the shared gamemode file.
include("sh_init.lua")
-- Add the Lua files that we need to send to the client.
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("sh_init.lua")
AddCSLuaFile("sh_config.lua")
AddCSLuaFile("sh_enumerations.lua")
AddCSLuaFile("scoreboard/admin_buttons.lua")
AddCSLuaFile("scoreboard/player_frame.lua")
AddCSLuaFile("scoreboard/player_infocard.lua")
AddCSLuaFile("scoreboard/player_row.lua")
AddCSLuaFile("scoreboard/scoreboard.lua")
AddCSLuaFile("scoreboard/vote_button.lua")
-- Enable realistic fall damage for this gamemode.
game.ConsoleCommand("mp_falldamage 1\n")
game.ConsoleCommand("sbox_godmode 0\n")
game.ConsoleCommand("sbox_plpldamage 0\n")
-- Check to see if local voice is enabled.
if (GM.Config["Local Voice"]) then
game.ConsoleCommand("sv_voiceenable 1\n")
game.ConsoleCommand("sv_alltalk 1\n")
game.ConsoleCommand("sv_voicecodec voice_speex\n")
game.ConsoleCommand("sv_voicequality 5\n")
end
-- Some useful ConVars that can be changed in game.
CreateConVar("cider_ooc", 1)
util.AddNetworkString("cider_Laws")
util.AddNetworkString("cider_Access")
util.AddNetworkString("cider_Container_Update")
util.AddNetworkString("cider_Container")
util.AddNetworkString("helpReplace")
-- Conetents
local path = GM.Folder.."/content"
local folders = {""}
while true do
local curdir = table.remove(folders,1)
if not curdir then break end
local searchdir = path..curdir
for _, filename in ipairs(file.Find(searchdir.."/*", "GAME")) do
if filename ~= ".svn" then
if file.IsDir(searchdir.."/"..filename, "GAME") then
table.insert(folders,curdir.."/"..filename)
else
resource.AddSingleFile(string.sub(curdir.."/"..filename,2))
end
end
end
end
local hook,player,g_player,umsg,pairs,ipairs,string,timer,IsValid,table,math = hook,player,g_player,umsg,pairs,ipairs,string,timer,IsValid,table,math
do
-- Store the old hook.Call function.
local hookCall = hook.Call
-- Overwrite the hook.Call function.
function hook.Call(name, gm, ply, text, ...) -- the wonders of lau :v:
if (name == "PlayerSay") then text = string.Replace(text, "$q", "\"") end
-- Call the original hook.Call function.
return hookCall(name, gm, ply, text, ...)
end
local m = FindMetaTable("Player")
if m then
function m:mGive(class)
local w = ents.Create(class)
w:SetPos(self:GetPos() + Vector(0,0,30))
w:Spawn()
end
end
local d = numpad.Deactivate
function numpad.Deactivate(p,...)
if not IsValid(p) then return end
d(p,...)
end
end
-- A table that will hold entities that were there when the map started.
GM.entities = {}
-- Called when the server initializes.
function GM:Initialize()
ErrorNoHalt"----------------------\n"
ErrorNoHalt(os.date().." - Server starting up\n")
ErrorNoHalt"----------------------\n"
local host = self.Config["MySQL Host"]
local username = self.Config["MySQL Username"]
local password = self.Config["MySQL Password"]
local database = self.Config["MySQL Database"]
-- Initialize a connection to the MySQL database.
self.DB, err = mysqloo.connect(self.Config["MySQL Host"], self.Config["MySQL Username"], self.Config["MySQL Password"], self.Config["MySQL Database"], 3306)
if (!self.DB) then
ErrorNoHalt("DB Connection error: "..err)
end
self.DB.OnError = function(self, err)
print("DB Connection error: "..err)
end
self.DB.OnConnected = function()
--THIS IS JUST TEMPORARY.
local qq = self.DB:query([[
CREATE TABLE IF NOT EXISTS `players`
`_RPName` longtext NOT NULL,
`_Key` int(11) NOT NULL PRIMARY KEY,
`_Name` longtext NOT NULL,
`_Clan` longtext NOT NULL,
`_Description` longtext NOT NULL,
`_SteamID` longtext NOT NULL,
`_UniqueID` longtext NOT NULL,
`_Access` longtext NOT NULL,
`_Donator` longtext NOT NULL,
`_Arrested` longtext NOT NULL,
`_Inventory` longtext NOT NULL,
`_Blacklist` longtext NOT NULL,
`_Misc` longtext NOT NULL
]])
qq:start();
print("Successfully connected to database!")
timer.Create("mysqloo.checkConnection", 30, 0, function()
local q = self.DB:query("SELECT 1+1")
q:start();
local status = self.DB:status()
if (status == mysqloo.DATABASE_NOT_CONNECTED) then
self.DB:connect()
timer.Destroy("mysqloo.checkConnection")
end
end)
end
self.DB:connect()
-- Call the base class function.
return self.BaseClass:Initialize()
end
function GM:Query(query, callback)
if self.DB and (query) then
local q = self.DB:query(query)
q.onSuccess = function(self, data)
if callback then
callback(data)
end
end
q.onError = function(self, err)
print("MYSQL ERROR: "..err)
end
q:start()
end
end
-- Called when all of the map entities have been\g initialized.
function GM:InitPostEntity()
--wait,returndelay
for _, entity in ipairs( ents.GetAll() ) do
if cider.entity.isDoor(entity) then
cider.entity.makeOwnable(entity)
end
self.entities[entity] = entity
end
timer.Simple(0, function()
hook.Call("LoadData",self); -- Tell plugins to load their datas a frame after this.
end)
self.Inited = true;
-- Call the base class function.
return self.BaseClass:InitPostEntity()
end
-- Called when a player attempts to punt an entity with the gravity gun.
function GM:GravGunPunt(ply, entity) return ply:IsAdmin() end
-- Called when a player attempts to pick up an entity with the physics gun.
function
Sorry, you need to Log In to post a reply to this thread.