Gravestone Posted April 23, 2016 Share Posted April 23, 2016 I was wondering if it is possible to show weapon levels (Poor, Gangster, Hitman) instead of their values. Here's the script (taken from the freeroam resource) which creates the stats window. function initStats() applyToLeaves(getGridListCache(wndStats, 'statslist'), function(leaf) leaf.value = getPedStat(g_Me, leaf.id) end) end function selectStat(leaf) setControlNumber(wndStats, 'statval', leaf.value) end function maxStat(leaf) setControlNumber(wndStats, 'statval', 1000) applyStat() end function applyStat() local leaf = getSelectedGridListLeaf(wndStats, 'statslist') if not leaf then return end local value = getControlNumber(wndStats, 'statval') if not value then return end leaf.value = value server.setPedStat(g_Me, leaf.id, value) end wndStats = { 'wnd', text = 'Stats', width = 300, x = -20, y = 0.3, controls = { { 'lst', id='statslist', width=280, height=260, columns={ {text='Stat', attr='name', width=0.6}, {text='Value', attr='value', width=0.3, enablemodify=true} }, rows={xml='stats.xml', attrs={'name', 'id'}}, onitemclick=selectStat, }, {'btn', id='Close', closeswindow=true} }, oncreate = initStats } And here's the list of the stats. Link to comment
Captain Cody Posted April 23, 2016 Share Posted April 23, 2016 Use > < and = Check if its below a certain value, above it, in middle etc. Link to comment
Captain Cody Posted April 23, 2016 Share Posted April 23, 2016 (edited) Poor = -- put highest value for poor here // When it changes from poor to gangster Gangster = -- put highest value for gangster here. // When it changes from gangster to hitman If stat < Poor then level = "poor" elseif stat > poor and stat < Gangster then level = "Gangster" else level = "Hitman" -- Not tested Edited April 23, 2016 by Guest Link to comment
Gravestone Posted April 23, 2016 Author Share Posted April 23, 2016 Every stat ID has different values at which a certain level is reached. Means I should use elseif for all the stats? Link to comment
Captain Cody Posted April 23, 2016 Share Posted April 23, 2016 You may have to make a table that defines the Poor, and Gangster values for each stat. Link to comment
Gravestone Posted April 24, 2016 Author Share Posted April 24, 2016 I can't understand. Here's the table. stats = { {77 = "0, 200, 999"}, -- Ak47 {78 = "0, 200, 999"}, -- M4 {69 = "0, 40, 999"}, -- USP. 45 {71 = "0, 200, 999"}, -- Desert Eagle {76 = "0, 250, 999"}, -- MP5 {73 = "0, 200, 999"}, -- Sawn off {72 = "0, 200, 999"}, -- Shotgun {70 = "0, 500, 999"}, -- Silenced Pistol {79 = "0, 300, 999"}, -- Sniper rifle {74 = "0, 200, 999"}, -- Spaz 12 {75 = "0, 50, 999"} -- Micro Uzi } Link to comment
Moderators IIYAMA Posted April 29, 2016 Moderators Share Posted April 29, 2016 This is a part of my syncro resource, which converts weapon stats to: poor std and pro. local weaponStats = { [22]={69,40},[23]={70,500}, [24]={71,200},[25]={72,200},[26]={73,200}, [27]={74,200},[28]={75,50},[29]={76,250}, [30]={77,200},[31]={78,200},[32]={76,50}, [33]={79,300},[34]={79,300} } local weapon = 22 local weaponState, skill = weaponStats[weapon], "pro" if weaponState then local stats = getPedStat ( localPlayer, weaponState[1] ) if stats < 999 then skill = stats >= weaponState[2] and "std" or "poor" end end I hope this can help you as inspiration. 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