Tronox Posted September 16, 2009 Share Posted September 16, 2009 Hi, when I start my script and write a command (testmeme) it says: [17:57:34] ERROR: Database query failed: no such column: spawn [17:57:34] WARNING: basic.lua: Bad argument @ 'outputChatBox' - Line: 22 Here's my script: function joinHandler() local x = 1959.55 local y = -1714.46 local z = 10 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to My Server", source) executeSQLCreateTable ( "player", "accountName TEXT, spawn INTEGER" ) end addEventHandler("onPlayerJoin", getRootElement(), joinHandler) function saveMe(player) local x, y, z = getElementPosition (player) pName = getPlayerName(player) executeSQLUpdate ( "player", "spawn = x, y, z", "accountName = pName" ) end addEventHandler ("OnPlayerQuit", getRootElement(), saveMe) function testMe(player) result = executeSQLSelect( "player", "spawn", "accountName= pName") outputChatBox(result, player) end addCommandHandler("testmeme", testMe) Thanks Link to comment
50p Posted September 16, 2009 Share Posted September 16, 2009 You probably try to create table "player" which already exists in your database and has different columns. Use SQLite Database Browser to open registry.db file located in your server directory. There are many things wrong with your code as well... - look at this syntax highlighting: executeSQLUpdate ( "player", "spawn = x, y, z", "accountName = pName" ) Here, on the forum, strings are red. At this line, pName will be "pName" (which is string) not player's name. - OnPlayerQuit is not the same as onPlayerQuit. Lua is case sensitive and so are event names. - outputChatBox(result, player) - this is wrong too... you can't output result just like that... outputChatBox requires string not a table nor boolean. You sure need to read the scripting basics... - https://wiki.multitheftauto.com/index.ph ... troduction - http://robhol.net/guide/basics 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