Noki Posted February 7, 2015 Posted February 7, 2015 (edited) Hello, So, I'm getting an error every time a player disconnects with a high wanted level (getElementData( plr, "wantedPoints" )). It says: (1246) Out of range value for column 'wanted' at row 1 I had a look on stackoverflow.com, and people there suggested to change the column data type to unassigned integer. Maybe a bigint would also work? But that makes no sense, because the wantedLevel element data, will return 4 digit numbers with 3 integers max (2035.432 for example). Here is the code below. There is more to it, but it has no effect on the issue at hand. db = exports.sql:getConnection() function savePlayerData ( thePlayer ) if ( exports.core:getPlayerAccountID( thePlayer ) ) then if ( isPedDead( thePlayer ) ) then armor = 0 else armor = getPedArmor( thePlayer ) end local x, y, z = getElementPosition ( thePlayer ) local playtime = getElementData( thePlayer, "playTime" ) local wantedPoints = getElementData( thePlayer, "wantedPoints" ) local money = getPlayerMoney( thePlayer ) local interior = getElementInterior( thePlayer ) local dimension = getElementDimension( thePlayer ) local rot = getPedRotation( thePlayer ) local occupation = exports.core:getPlayerOccupation( thePlayer ) local team = getTeamName( getPlayerTeam( thePlayer ) ) local id = exports.core:getPlayerAccountID( thePlayer ) if ( playtime ) then dbExec( db, "UPDATE `accounts` SET `money`=?, `health`=?, `armor`=?, `wanted`=?, `x`=?, `y`=?, `z`=?, `interior`=?, `dimension`=?, `rotation`=?, `occupation`=?, `team`=?, `playtime`=? WHERE `id`=?", money, getElementHealth( thePlayer ), armor, wantedPoints, x, y, z, interior, dimension, rot, occupation, team, playtime, id ) else -- don't set playtime to avoid the risk of losing it all dbExec( db, "UPDATE `accounts` SET `money`=?, `health`=?, `armor`=?, `wanted`=?, `x`=?, `y`=?, `z`=?, `interior`=?, `dimension`=?, `rotation`=?, `occupation`=?, `team`=? WHERE `id`=?", money, getElementHealth( thePlayer ), armor, wantedPoints, x, y, z, interior, dimension, rot, occupation, team, id ) end return true else return false end end Edited February 7, 2015 by Guest
Noki Posted February 7, 2015 Author Posted February 7, 2015 math.round ? Tried it, with no avail. Still produces the same error.
Tomas Posted February 7, 2015 Posted February 7, 2015 math.round ? Tried it, with no avail. Still produces the same error. Hm, try saving the data as strings. I got it! Execute this sentence. ALTER TABLE `tableName` CHANGE `columnName` `columnName` SMALLINT( 11 ) NOT NULL
Noki Posted February 7, 2015 Author Posted February 7, 2015 Alright fixed the issue. Looked into the sql resource, turns out it is altering the table to be a smallint, unbeknownst to me. Changed it to an integer. Solved. But thank you anyway, Ares.
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