Jump to content

Simple Script Error - Help Fix It? Please


Recommended Posts

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.

Link to comment

It's not like we are going to believe you. First, why do you choose a script which, apart from being leaked, is more advanced than many other scripts you could learn from? And second, how can you learn by having someone else fix something that you didn't make?

Seriously, I don't understand why you are doing this. Why do you want to make a server with leaked scripts instead of making your own? What's the point of opening an art exhibition if you have nothing of your own to show?

Link to comment

Well its not like I don't know how to code.

I do my own web development.. and I have my own social network.. So I understand alot of what I see. What I don't understand is the errors... Your right it is advanced. The code isn't written by me.. but that doesn't stop it from being usable. Its easier to learn code by editing existing code then trying over from stratch. I will give the original developers their credits.. as they deserve it.. Eventually I will make the code better, if I get that advanced. I have no intentions on running a server.. so after I'm done. I'lll give them the updated code.. as if they want it. Otherwise I'll just opensource it... The point of opening an art exhibition if I have nothing to show. To show the world the work of others.. And how it makes my art Exhibit looks better.

Link to comment
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...