Jump to content

MySQL errors that do not make sense


Noki

Recommended Posts

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 by Guest
Link to comment

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...