• Print

Author Topic: Need a bit of help with a gamemode error  (Read 5414 times)

0 Members and 1 Guest are viewing this topic.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Need a bit of help with a gamemode error
« on: June 02, 2016, 11:02:27 am »
I am trying to fix a gamemode that at this moment in time is broken

[ERROR] gamemodes/CityRP/gamemode/core/libraries/sv_player.lua:648: attempt to call field 'escape' (a nil value)
  1. loadData - gamemodes/CityRP/gamemode/core/libraries/sv_player.lua:648
   2. unknown - gamemodes/CityRP/gamemode/init.lua:733

The line that is stated as an error is

Code: Lua
  1.         local name = tmysql.escape(player:Name());
  2.         local steamID = tmysql.escape(player:SteamID());
  3.         local uniqueID = tmysql.escape(player:UniqueID());

I dont know how much is needed for help I work with lua not MySQL

Any and all help is appreciated.
« Last Edit: June 02, 2016, 11:22:59 am by lampman13 »

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Need a bit of help with a gamemode error
« Reply #1 on: June 02, 2016, 11:13:56 am »
Check this out, may help you. Don't know though. If not, I don't really know lol
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: Need a bit of help with a gamemode error
« Reply #2 on: June 02, 2016, 11:18:07 am »
Thanks for the help but I have looked at that several times and I cant seem to get the same results that he did .-.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Need a bit of help with a gamemode error
« Reply #3 on: June 02, 2016, 11:25:44 am »
look at the last post.. You need to include your database object in that function.

local name = tmysql.escape(BATABASE_OBJECT, player:Name());
local steamID = tmysql.escape(BATABASE_OBJECT, player:SteamID());
local uniqueID = tmysql.escape(BATABASE_OBJECT, player:UniqueID());

Since you didn't post your whole code, I can't tell you what that is.. you'll need to figure it out on your own..

and FYI, this is lua.. not SQL.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: Need a bit of help with a gamemode error
« Reply #4 on: June 02, 2016, 11:27:02 am »
I understand that it is lua that is obvious but I dont normally work with MySQL I dont understand it and thanks I'll see what I can do

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: Need a bit of help with a gamemode error
« Reply #5 on: June 02, 2016, 11:39:10 am »
[ERROR] gamemodes/CityRP/gamemode/core/libraries/sv_player.lua:647: attempt to call field 'Escape' (a nil value)

I am still getting the same error
I changed it as you said but I still get it. The tmysql.Initialize is in a different file on serverside but the databaseobject is db just as his is

Code: Lua
  1.         local db, err = tmysql.initialize(host, username, password, database, 3306, 5, 5);
  2.         DBConn = db
  3.         local scode = GetConVar("sv_logdownloadlist"):GetString();
  4.         resource.AddFile("maps/"..string.lower(game.GetMap())..".bsp")
  5.         print("SERVER CODE: "..scode)

so I changed it as did he

Code: Lua
  1.         local name = tmysql.Escape(db, player:Name());
  2.         local steamID = tmysql.Escape(db, player:SteamID());
  3.         local uniqueID = tmysql.Escape(db, player:UniqueID());

P.S. Probably being a total nub thanks for the help
« Last Edit: June 02, 2016, 11:51:47 am by lampman13 »

Offline iViscosity

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 803
  • Karma: 58
Re: Need a bit of help with a gamemode error
« Reply #6 on: June 02, 2016, 12:14:33 pm »
tmysql:Escape not tmysql.Escape. thats what I picked up from that link I posted. Try that.

Also must be serverside (or shared with if SERVER then) but I assume you did that. You also have tmysql:Escape, so it may be that you need ( tmysql, ... )

Honestly I'm guessing here lol
« Last Edit: June 02, 2016, 12:18:26 pm by iViscosity »
I'm iViscosity. I like gaming and programming. Need some help? Shoot me PM.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: Need a bit of help with a gamemode error
« Reply #7 on: June 02, 2016, 12:21:48 pm »
I am as well lol I never would have something like that on clientside anyway and I will try that thanks for the reply.

Offline lampman13

  • Jr. Member
  • **
  • Posts: 71
  • Karma: -10
Re: Need a bit of help with a gamemode error
« Reply #8 on: June 02, 2016, 12:24:54 pm »
with that I get

attempt to call method 'Escape' (a nil value)

It is making no sense to me lol

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Need a bit of help with a gamemode error
« Reply #9 on: June 02, 2016, 02:57:15 pm »
Code: [Select]
local name = db:Escape(ply:Name());

Assuming ply is defined as a player.  Using "player:" like you have is also problematic.  You're confusing libraries with instantiated objects.

We really need to see more of your code.
« Last Edit: June 02, 2016, 02:59:18 pm by Buzzkill »

  • Print