-.Paradox.- Posted July 19, 2013 Posted July 19, 2013 Hello all, i'm trying to transform rank numbers to image, here is the lua local levels = {[200] = 1, [500] = 2, [600] = 3, [1000] = 4, [2000] = 5, [3000] = 6, [4000] = 7, [5000] = 8, [9000] = 9} function win(ammo, killer, weapon, bodypart) if (killer and killer ~= source) then local H = getElementData(killer, "Reputation") local S = getElementData(killer, "Rank") local killer1 = getPlayerName(killer) local noob = getPlayerName(source) setElementData(killer, "Reputation", tonumber(H)+math.random ( 20, 50 ) ) if levels[tonumber(H)] then setElementData(killer, "Rank", "Rank ".. tostring(levels[tonumber(H)]) .." ! ") triggerClientEvent ( killer, "playSound", killer ) end end local H = getElementData ( source, "Reputation" ) or 0 setElementData ( source, "Reputation", tonumber ( H ) - math.random ( 20, 50 ) ) end addEventHandler( "onPlayerWasted", getRootElement(), win) function onLogin (_,account) setElementData(source, "Rank", getAccountData(account, "Rnk") or "0") setElementData(source, "Reputation", getAccountData(account, "Rep") or "0") end addEventHandler ("onPlayerLogin", root, onLogin) function saveData(thePlayer, theAccount) if (theAccount and not isGuestAccount(theAccount)) then setAccountData (theAccount, "Rnk", getElementData(thePlayer, "Rank")) setAccountData (theAccount, "Rep", getElementData(thePlayer, "Reputation")) end end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) Also i want add them to scoreboard elseif column.name == "Rank" then column.width = 20 dxDrawImage( topX+theX, y+s(1), 16, 11, content, 0, 0, 0, cWhite, drawOverGUI ) Ranks images are Rank/Lvl1.png ......... Rank/Lvl9.png I hope somebody help me in this, and thanks If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted July 20, 2013 Author Posted July 20, 2013 Bump ! If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Jaysds1 Posted July 20, 2013 Posted July 20, 2013 try this: local levels = { [200] = "1", [500] = "2", [600] = "3", [1000] = "4", [2000] = "5", [3000] = "6", [4000] = "7", [5000] = "8", [9000] = "9" } addEventHandler( "onPlayerWasted",root, function(_, killer) if (killer and killer ~= source) then local Rep = tonumber(getElementData(killer, "Reputation")) or 0 local Rank = getElementData(killer, "Rank") local kName = getPlayerName(killer) local sName = getPlayerName(source) setElementData(killer, "Reputation", Rep + math.random ( 20, 50 ) ) if levels[Rep] then setElementData(killer, "Rank", "Rank ".. levels[Rep] .." ! ") triggerClientEvent ( killer, "playSound", killer ) end end local Rep = tonumber(getElementData ( source, "Reputation" )) or 0 setElementData ( source, "Reputation", Rep - math.random ( 20, 50 ) ) end) addEventHandler ("onPlayerLogin", root, function (_,curAcc) setElementData(source, "Rank", getAccountData(curAcc, "Rank") or "0") setElementData(source, "Reputation", getAccountData(curAcc, "Rep") or 0) end) function saveData(source, acc) if not acc or isGuestAccount(acc)then return end setAccountData (acc, "Rnk", getElementData(source, "Rank")) setAccountData (acc, "Rep", getElementData(source, "Reputation")) end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (acc) saveData(source, acc) end) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
-.Paradox.- Posted July 20, 2013 Author Posted July 20, 2013 I will try thanks for youre help. location for them is ":Reputation/Reputation/Rank"..rank..".png" If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted July 21, 2013 Author Posted July 21, 2013 Didn't work no errors, i guess forgot to check if FileExist If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Jaysds1 Posted July 21, 2013 Posted July 21, 2013 local levels = { [200] = "1", [500] = "2", [600] = "3", [1000] = "4", [2000] = "5", [3000] = "6", [4000] = "7", [5000] = "8", [9000] = "9" } addEventHandler( "onPlayerWasted",root, function(_, killer) if (killer and killer ~= source) then local Rep = tonumber(getElementData(killer, "Reputation")) or 0 local kName = getPlayerName(killer) local sName = getPlayerName(source) setElementData(killer, "Reputation", Rep + math.random ( 20, 50 ) ) if levels[Rep] then setElementData(killer, "Rank", "Rank/Lvl".. levels[Rep] ..".png") --Rank/Lvl1.png triggerClientEvent ( killer, "playSound", killer ) end end local Rep = tonumber(getElementData ( source, "Reputation" )) or 0 setElementData ( source, "Reputation", Rep - math.random ( 20, 50 ) ) end) addEventHandler ("onPlayerLogin", root, function (_,curAcc) setElementData(source, "Rank", getAccountData(curAcc, "Rank") or "0") setElementData(source, "Reputation", getAccountData(curAcc, "Rep") or 0) end) function saveData(source, acc) if not acc or isGuestAccount(acc)then return end setAccountData (acc, "Rnk", getElementData(source, "Rank")) setAccountData (acc, "Rep", getElementData(source, "Reputation")) end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (acc) saveData(source, acc) end) My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
-.Paradox.- Posted August 5, 2013 Author Posted August 5, 2013 Not working If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
-.Paradox.- Posted August 6, 2013 Author Posted August 6, 2013 Heeelp If you're looking for a cheap paid scripter, don't hesitate to contact me. Great minds discuss ideas, Average minds discuss events and small minds discuss people.
Jaysds1 Posted August 6, 2013 Posted August 6, 2013 try this: local levels = { [200] = "1", [500] = "2", [600] = "3", [1000] = "4", [2000] = "5", [3000] = "6", [4000] = "7", [5000] = "8", [9000] = "9" } addEventHandler( "onPlayerWasted",root, function(_, killer) if (killer and killer ~= source) then local Rep = tonumber(getElementData(killer, "Reputation")) or 0 local kName = getPlayerName(killer) local sName = getPlayerName(source) setElementData(killer, "Reputation", Rep + math.random ( 20, 50 ) ) if levels[Rep] then setElementData(killer, "Rank", ":Reputation/Reputation/Rank/Lvl".. levels[Rep] ..".png") -- :Reputation/Reputation/Rank/Lvl1.png triggerClientEvent ( killer, "playSound", killer ) end end local Rep = tonumber(getElementData ( source, "Reputation" )) or 0 setElementData ( source, "Reputation", Rep - math.random ( 20, 50 ) ) end) addEventHandler ("onPlayerLogin", root, function (_,curAcc) setElementData(source, "Rank", getAccountData(curAcc, "Rank") or "0") setElementData(source, "Reputation", getAccountData(curAcc, "Rep") or 0) end) function saveData(source, acc) if not acc or isGuestAccount(acc)then return end setAccountData (acc, "Rnk", getElementData(source, "Rank")) setAccountData (acc, "Rep", getElementData(source, "Reputation")) end addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) addEventHandler ("onPlayerLogout", root, function (acc) saveData(source, acc) end) And please tell me if there's an error or why it's not working! My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
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