Jump to content

I need help with Turfing script


Franks#

Recommended Posts

Posted

Hello there dear community, I we've been trying to fix my old turfing script for hours, and it won't work. I am talking about a typical RPG Turfing script. I turn the script on, and I spawn as an official gang and I try to turn it on with a command, everything goes well, but no turfs poop up, I guess I have to make them somehow can someone help me. I need answers fast, thanks.


There also might be something wrong with this:
 

Spoiler



local query = executeSQLQuery("SELECT id, owner, x, y, w, h, r, g, b FROM `war`")
if #query > 0 then
for i,node in ipairs(query) do


And this
 

Spoiler


addEventHandler("onResourceStart", getResourceRootElement(getThisResource()),
function() 
for i,b in ipairs(turfs) do
executeSQLQuery("INSERT INTO war VALUES (?, 'Nobody', ?, ?, ?, ?, 0, 255, 0)", i+17, b[1], b[2], b[3], b[4])
end
stopResource(getThisResource())
end
)

 

  • Moderators
Posted

ID should be handled by the database, not by LUA. (unless you have special reason for that)

And make sure you define the column names before inserting.

 

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted
1 hour ago, IIYAMA said:

ID should be handled by the database, not by LUA. (unless you have special reason for that)

And make sure you define the column names before inserting.

 

Well I have no idea about Databases, could u help me a little more?

  • Moderators
Posted

https://www.w3schools.com/sql/sql_insert.asp

Use Google first, it is 10000000000000000000000000000000x smarter than me.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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