verona Posted August 14, 2012 Share Posted August 14, 2012 Hi. Sory for bad english. I download and running this script: https://community.multitheftauto.com/index.php?p= ... ils&id=811 Points works OK, but if i reconnect, then all stats going to 0. Why this cant save? In console: [2012-08-14 14:15:40] Stopping userpanel[2012-08-14 14:15:41] Starting userpanel [2012-08-14 14:15:41] Creating new DB table RaceStats [2012-08-14 14:15:41] INFO: Race userpanel by Castillo loaded. [2012-08-14 14:15:41] userpanel restarted successfully [2012-08-14 14:16:38] ERROR: [gamemodes]/[race]/[addons]/userpanel/server.lua:242: attempt to index field '?' (a nil value) This is line 242: newData = tonumber(oldData[1]["RaceWins"]) + 1 And this is function: addEventHandler("onPlayerWasted",rootElement, function () setElementData(source,"Race Loses",tonumber(getElementData(source,"Race Loses"))+1) setElementData(source,"Points",tonumber(getElementData(source,"Points"))-2) local serial = getPlayerSerial(source) local oldData = executeSQLSelect( "RaceStats", "RaceLoses","serial = '" .. serial .. "'") newData = tonumber(oldData[1]["RaceWins"]) + 1 executeSQLUpdate ( "RaceStats", "RaceLoses = '"..newData.."'","serial = '" .. serial .. "'") end) I think problem is with SQL commands, but why? Where is this .db file? Maybe is this permission problem? Somebody can help me with this? PS Car color and lights is restarted in new map Link to comment
Castillo Posted August 14, 2012 Share Posted August 14, 2012 The resource is outdated badly, I didn't get free time to update it yet ( if I ever do ). Link to comment
verona Posted August 14, 2012 Author Share Posted August 14, 2012 Oh, ok you dont have time But you know what is wrong, and tell me? I should use newest commands, or what? Its very important for me Link to comment
Anderl Posted August 15, 2012 Share Posted August 15, 2012 If I am not wrong: local oldData = executeSQLSelect( "RaceStats", "RaceLoses","serial = '" .. serial .. "'") Will just select "RaceLoses" not "RaceWins". 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