Best-Killer Posted December 14, 2016 Share Posted December 14, 2016 Hello Guys , i want know how to get data from database then i put them in dx text give me example or tell me what problem here :v i tried with : function testdr (d) dxDrawText(tostring(d.mystats.arrests), 524, 250, 720, 322, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end addEventHandler("onClientPreRender", root,testdr) addEvent ( "SAEGJobs:Modules->Panel:OnServerSendClientData", true ) addEventHandler ( "SAEGJobs:Modules->Panel:OnServerSendClientData", root, function ( d ) testdr(d) end ) addEvent ( "SAEGJobs:Modules->Panel:RequestData", true ) addEventHandler ( "SAEGJobs:Modules->Panel:RequestData", root, function () local user = getAccountName ( getPlayerAccount ( source ) ) local jobData = exports.SAEGJobs:getJobRankTable ( )['police officer'] if ( getElementData ( source, "Job" ):lower( ) == "Detective" ) then jobData = exports.SAEGJobs:getJobRankTable ( )['police officer'] end local data = { } data.mystats = { } data.mystats.arrests = exports.SAEGJobs:getJobColumnData ( user, "Arrests" ) data.mystats.solvedCrims = exports.SAEGJobs:getJobColumnData ( user, "SolvedCrims" ) data.mystats.rank = getElementData ( source, "Job Rank" ) local ranks = { } local ranks_ = { } for i, v in pairs ( jobData ) do table.insert ( ranks, { i, v } ) end table.sort ( ranks, function ( a, b, x ) return a[1] > b[1] end ) for i=#ranks, 1, -1 do table.insert ( ranks_, ranks [ i ] ) end local ranks = ranks_ local nextRank = "None" local nextRankArrests = "None" local isNext = false for i, v in ipairs ( ranks ) do if ( isNext ) then nextRank = v[2] nextRankArrests=v[1] break end if ( v[2] == data.mystats.rank ) then isNext = true end end data.mystats.nextRank = nextRank data.mystats.nextRankArrests = nextRankArrests triggerClientEvent ( source, "SAEGJobs:Modules->Panel:OnServerSendClientData", source, data ) end ) Link to comment
Best-Killer Posted December 14, 2016 Author Share Posted December 14, 2016 any one pleae ??? Link to comment
pa3ck Posted December 14, 2016 Share Posted December 14, 2016 local d = {} function testdr () if #d > 0 then dxDrawText(tostring(d.mystats.arrests), 524, 250, 720, 322, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end end addEvent ( "SAEGJobs:Modules->Panel:OnServerSendClientData", true ) addEventHandler ( "SAEGJobs:Modules->Panel:OnServerSendClientData", root, function ( data ) d = data addEventHandler("onClientPreRender", root,testdr) end ) Link to comment
Best-Killer Posted December 14, 2016 Author Share Posted December 14, 2016 0 errors and the text not showing :v nvm fixed Link to comment
pa3ck Posted December 14, 2016 Share Posted December 14, 2016 When you fix something, please let others know how you fixed it, so when they do a search and find this topic, there will be a working solution. 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