FishBurger987 Posted July 25, 2019 Share Posted July 25, 2019 I have this script and it worked before but after a server restart, it doesn't.. It's a script for opening gates. The full code: https://pastebin.com/Y6SPktEU Then I get these erros whenever I try to open a gate with the script's command, which is /gate. [21:55:57] WARNING: mta_gates/server.Lua:99: Bad argument @ 'getDistanceBetweenPoints3D' [Expected vector3 at argument 4, got none] [21:55:57] ERROR: mta_gates/server.Lua:101: attempt to compare nil with number How do I fix this? Link to comment
JeViCo Posted July 26, 2019 Share Posted July 26, 2019 The first error (Expected vector3 at argument 4, got none) Line 99: dis2 = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) so variable x2 equals to none. You got x2, y2 and z2 variables right here: local x2, y2, z2 = getElementPosition(gates[key]["gate"]) So the problem is in your gates table A little advice: On the previous step you're making a loop: for key, value in ipairs(gates) do and you can replace gates[key]["gate"] with value.gate or value["gate"] and get the same result The second error is caused by previous one as the dis2 variable has no value. 1 Link to comment
FishBurger987 Posted July 27, 2019 Author Share Posted July 27, 2019 (edited) On 26/07/2019 at 11:06, JeViCo said: The first error (Expected vector3 at argument 4, got none) Line 99: dis2 = getDistanceBetweenPoints3D(x, y, z, x2, y2, z2) so variable x2 equals to none. You got x2, y2 and z2 variables right here: local x2, y2, z2 = getElementPosition(gates[key]["gate"]) So the problem is in your gates table A little advice: On the previous step you're making a loop: for key, value in ipairs(gates) do and you can replace gates[key]["gate"] with value.gate or value["gate"] and get the same result The second error is caused by previous one as the dis2 variable has no value. Thank you for your reply, you have given me a way better explanation of what's going on in the script, than the guys at server hosting in customer service. But the thing is I don't own this script, and I don't know a thing about Lua scripting, sooo... I understand what you wrote, and you say the problem is in mysql? Here's a picture of a gate in MySQL. Image Isn't "default state" x y z as in dis and "changed state" x2 y2 z2 as in dis2? How do I fix it? Edited July 27, 2019 by FishBurger987 Added + info 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