Okay... so here is the error.
[2013-06-14 16:22:09] ERROR: mysql\connection.lua:210: bad argument #2 to 'mysql_escape_string' (string expected, got nil)
[2013-06-14 16:22:09] ERROR: mysql\connection.lua:210: bad argument #2 to 'mysql_escape_string' (string expected, got nil)
[2013-06-14 16:22:09] ERROR: call: failed to call 'mysql:escape_string' [string "?"]
[2013-06-14 16:22:09] ERROR: RESOURCE_FOLDER\RESOURCE_FILE.lua:44: attempt to concatenate a boolean value
Here is the Mysql Code.. the mysql_escape_string part.. I will make it understandable.
function escape_string(str)
return mysql_escape_string(MySQLConnection, str)
end -- Escape String Function
MySQLConnection = mysql_connect(hostname, username, password, database, port) -- The Connection Variable
str is the string that you put inside of it when you call the global variable from the export
This is the main code that has an error.
function createElevator(thePlayer, commandName, interior, dimension, ix, iy, iz)
if not (interior) or not (dimension) or not (ix) or not (iy) or not (iz) then
outputChatBox("SYNTAX: /" .. commandName .. " [int ID] [Dimension ID] [x] [y] [z]", thePlayer, 255, 194, 14)
else
local x, y, z = getElementPosition(thePlayer)
interior = tonumber(interior)
dimension = tonumber(dimension)
local interiorwithin = getElementInterior(thePlayer)
local dimensionwithin = getElementDimension(thePlayer)
ix = tonumber(ix)
iy = tonumber(iy)
iz = tonumber(iz)
id = SmallestElevatorID()
if id then
local query = mysql:query_free("INSERT INTO elevators SET id='" .. mysql:escape_string(id) .. "', x='" .. mysql:escape_string(x) .. "', y='" .. mysql:escape_string(y) .. "', z='" .. mysql:escape_string(z) .. "', tpx='" .. mysql:escape_string(ix) .. "', tpy='" .. mysql:escape_string(iy) .. "', tpz='" .. mysql:escape_string(iz) .. "', dimensionwithin='" .. mysql:escape_string(dimensionwithin) .. "', interiorwithin='" .. mysql:escape_string(interiorwithin) .. "', dimension='" .. mysql:escape_string(dimension) .. "', interior='" .. mysql:escape_string(interior) .. "'")
if (query) then
--reloadOneElevator(id, true)
loadOneElevator(id)
outputChatBox("Elevator created with ID #" .. id .. "!", thePlayer, 0, 255, 0)
end
else
outputChatBox("There was an error while creating an elevator. Try again.", thePlayer, 255, 0, 0)
end
end
end
end
addCommandHandler("addelevator", createElevator, false, false)
Now... if anyone does realize anything.. about this.. Script.. Which I bet you will. Please don't call me... a thief.. or some kind of crook. I did not steal these scripts. For One. Two. I'm simply a beginner. So Just like facebook.. I don't steal code. And I'm not planning on making a "server" I'm trying to gain the knowledge to make a real video game. and I just thought this is a good start. I'm more about innovation. Thankyou. Love you all.