Lukkaz Posted January 14, 2011 Posted January 14, 2011 addCommandHandler( "jailtime", function ( player, commandName ) if exports.players:isLoggedIn( player ) then local characterID = exports.players:getCharacterID( player ) if characterID then local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time= value.time if ( time >= 1 ) then outputChatBox ( "Your jailtime is "..time..".", source, 0, 255, 0 ) else outputDebugString("its not working it cant be compared(NIL)") end end end end end ) I been working on this for so long and getting quite frustrated it's probably a quick fix but I can not see it and come to you guys as a last resort.
SDK Posted January 14, 2011 Posted January 14, 2011 Your SQL query selects jailTime, not "time", I think this will do: local result = exports.sql:query_assoc( "SELECT jailTime FROM characters WHERE characterID = "..characterID ) for key, value in ipairs( result ) do local time= value.jailTime
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