DLmass Posted July 20, 2014 Posted July 20, 2014 Hi, I'd like to fix so I can delete markers with a command, I tried to do it but I cannot fix it. How can I solve this? local con = dbConnect("sqlite", "marker.db") dbExec(con, "CREATE TABLE IF NOT EXISTS marker ('x', 'y', 'z', 'dim', 'int')") function addMarker(player) local x,y,z = getElementPosition(player) local dim = getElementDimension(player) local int = getElementInterior(player) dbExec(con, "INSERT INTO marker VALUES (?, ?, ?, ?, ?)", x, y, z-1, dim, int) local marker = createMarker(x, y, z - 1, "cylinder", 1, 255, 0, 0, 150) setElementDimension(marker, dim) setElementInterior(marker, int) end addCommandHandler("am", addMarker) function deleteMarker(player) local x, y, z = getElementPosition(player) dbExec(con, "DELETE FROM marker WHERE x=? AND y=? and z=?", x, y, z) end addCommandHandler("dm", deleteMarker)
Castillo Posted July 20, 2014 Posted July 20, 2014 Well, that won't work, because when you create the marker, you take 1 from the Z position, but when you try to delete it, you don't add 1 to the Z position. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
DLmass Posted July 20, 2014 Author Posted July 20, 2014 Well, that won't work, because when you create the marker, you take 1 from the Z position, but when you try to delete it, you don't add 1 to the Z position. I almost got what you mean. But still very confused lol EDIT: Still haven't solved it!
Castillo Posted July 20, 2014 Posted July 20, 2014 I don't think using coordinates is a good idea, you should use IDs/names. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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