kamani Posted February 26, 2010 Share Posted February 26, 2010 Hi all my job save script is wrong, in server console (when quit of game) i get: attempt to concatenate global 'job' (a boolean value) This is code: (Server) function savejob() local nick = getPlayerName( source ) local job = getPlayerTeam( source ) local savequery = "UPDATE users SET jobname='" .. job .. "' WHERE username='" .. nick .."'" end addEventHandler ( "onPlayerQuit", getRootElement(), savejob) Link to comment
Jumba' Posted February 26, 2010 Share Posted February 26, 2010 You need to use getTeamName, getPlayerTeam returns the team element. https://wiki.multitheftauto.com/wiki/GetTeamName so it would be local job = getTeamName ( getPlayerTeam ( source ) ) Link to comment
robhol Posted February 26, 2010 Share Posted February 26, 2010 Also, making a variable named "query" does not magically create a database connection, query it and return results.. for MySQL you need a separate module, for MTA's built-in SQLite database, you still need to call functions. Link to comment
Jumba' Posted February 27, 2010 Share Posted February 27, 2010 Also, making a variable named "query" does not magically create a database connection, query it and return results.. for MySQL you need a separate module, for MTA's built-in SQLite database, you still need to call functions. I can't believe how I missed that part Here's the two MySQL modules by the way: https://wiki.multitheftauto.com/wiki/Modules/MTA-MySQL https://wiki.multitheftauto.com/wiki/Modules/MySQL I personally recommend MTA-MySQL. Link to comment
robhol Posted February 27, 2010 Share Posted February 27, 2010 Yes, MTA-MySQL is the way to go. The last one is not even worth mentioning, it's limited and unstable. But unless you have a specific reason to use MySQL AND a place to host it, you will probably want to stick to MTA's native SQL functions. 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