Mojko Posted July 4, 2017 Share Posted July 4, 2017 (edited) while true do local row = mysql_fetch_assoc(result) local xx = row["x"] local var_1 = 1 local var_2 = 1 outputChatBox(row["x"]) outputChatBox(turfInformation[1][X]) outputChatBox(row["y"]) outputChatBox(turfInformation[1][Y]) outputChatBox(maxZones) if(row["x"] == turfInformation[1][X]) then outputChatBox("Can't create a turf here") end end So, what do we have here? Basicly I want "Can't create a turf here" be sent as a message to the player if the "X" position in my MySQL table equals to the "X" position of turfInformation. This is what prints out in game at the moment: row["x"] = 2634.71 turfInformation[1][X] = 2634.71 row["y"] = -1649.41 turfInformation[1][Y] = -1649.41 So, what's the issue? "Can't create a turf here" never get's printed out. I've tried to take the value "2634.71" and make an if statement that looks like this: if(turfInformation[1][x] == 2634.71) And that works, but that's not what I want, I want to use row["x"] instead. Thank you! EDIT: Here's the query: local result = mysql_query(connection,"SELECT * FROM gang_territories") Edited July 4, 2017 by Mojko Link to comment
DNL291 Posted July 4, 2017 Share Posted July 4, 2017 Why do you want to do that? Do you want to check if there's already a turf in that location? Btw, make sure that '2634.71' isn't a string. Link to comment
Mojko Posted July 4, 2017 Author Share Posted July 4, 2017 Yes I do want to check if a turf already exist at the location. and thank you! row["x"] was apparently a string Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now