-.Paradox.- Posted November 7, 2013 Posted November 7, 2013 okay so i made this script, this suppose to set an image for a specified level like example: if player lvl is 1 then draw lvl_1.png etc and the porblem is it wont draw the image icon and there is nothing in debug so here is my code Server side addEventHandler ( "onPlayerJoin", root, function ( ) setElementData ( source, "Rankicon",":Class\Rank\rank_0.png" ) end ) addEventHandler ( "onPlayerLogin", root, function ( _, acc ) local accName = getAccountName ( acc ) local LV = getAccountData(acc, "LV") if (LV >= 0) then setElementData ( source, "Rankicon", ":Class\Rank\rank_0.png" ) elseif (LV >= 1) then setElementData ( source, "Rankicon", ":Class\Rank\rank_1.png" ) elseif (LV >= 2) then setElementData ( source, "Rankicon", ":Class\Rank\rank_2.png" ) elseif (LV >= 3) then setElementData ( source, "Rankicon", ":Class\Rank\rank_3.png" ) elseif (LV >= 4) then setElementData ( source, "Rankicon", ":Class\Rank\rank_4.png" ) elseif (LV >= 5) then setElementData ( source, "Rankicon", ":Class\Rank\rank_5.png" ) elseif (LV >= 6) then setElementData ( source, "Rankicon", ":Class\Rank\rank_6.png" ) elseif (LV >= 7) then setElementData ( source, "Rankicon", ":Class\Rank\rank_7.png" ) elseif (LV >= -- s8) --> then setElementData ( source, "Rankicon", ":Class\Rank\rank_8.png" ) elseif (LV >= 9) then setElementData ( source, "Rankicon", ":Class\Rank\rank_9.png" ) elseif (LV >= 10) then setElementData ( source, "Rankicon", ":Class\Rank\rank_10.png" ) elseif (LV >= 11) then setElementData ( source, "Rankicon", ":Class\Rank\rank_11.png" ) elseif (LV >= 12) then setElementData ( source, "Rankicon", ":Class\Rank\rank_12.png" ) elseif (LV >= 13) then setElementData ( source, "Rankicon", ":Class\Rank\rank_13.png" ) elseif (LV >= 14) then setElementData ( source, "Rankicon", ":Class\Rank\rank_14.png" ) elseif (LV >= 15) then setElementData ( source, "Rankicon", ":Class\Rank\rank_15.png" ) elseif (LV >= 16) then setElementData ( source, "Rankicon", ":Class\Rank\rank_16.png" ) elseif (LV >= 17) then setElementData ( source, "Rankicon", ":Class\Rank\rank_17.png" ) elseif (LV >= 18) then setElementData ( source, "Rankicon", ":Class\Rank\rank_18.png" ) elseif (LV >= 19) then setElementData ( source, "Rankicon", ":Class\Rank\rank_19.png" ) elseif (LV >= 20) then setElementData ( source, "Rankicon", ":Class\Rank\rank_20.png" ) elseif (LV >= 21) then setElementData ( source, "Rankicon", ":Class\Rank\rank_21.png" ) elseif (LV >= 22) then setElementData ( source, "Rankicon", ":Class\Rank\rank_22.png" ) elseif (LV >= 23) then setElementData ( source, "Rankicon", ":Class\Rank\rank_23.png" ) elseif (LV >= 24) then setElementData ( source, "Rankicon", ":Class\Rank\rank_24.png" ) elseif (LV >= 25) then setElementData ( source, "Rankicon", ":Class\Rank\rank_25.png" ) elseif (LV >= 26) then setElementData ( source, "Rankicon", ":Class\Rank\rank_26.png" ) elseif (LV >= 27) then setElementData ( source, "Rankicon", ":Class\Rank\rank_27.png" ) elseif (LV >= 28) then setElementData ( source, "Rankicon", ":Class\Rank\rank_28.png" ) elseif (LV >= 29) then setElementData ( source, "Rankicon", ":Class\Rank\rank_29.png" ) elseif (LV >= 30) then setElementData ( source, "Rankicon", ":Class\Rank\rank_30.png" ) else setElementData ( source, "Rankicon", ":Class\Rank\rank_0.png" ) end end ) Client side addEventHandler("onClientRender", root, function() local Rankicon = getElementData(localPlayer,"Rankicon") local Level = getElementData(localPlayer,"Level") if Level and fileExists ( ":Class/Rank/rank_"..Rankicon..".png" ) then size = dxGetFontHeight((0.7/1366)*sWidth, "bankgothic") dxDrawImage((557/1024)*sWidth, (745/768)*sHeight, size, size, (":Class/Rank/rank_"..Rankicon..".png") end end ) 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.
Castillo Posted November 7, 2013 Posted November 7, 2013 Maybe because you are using the path wrong? in element data you are storing everything, path included, and then in dxDrawImage/fileExists you are adding the path again ( along with the saved path ), do you get what I mean? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted November 7, 2013 Author Posted November 7, 2013 But how i must define the location path? 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.
Castillo Posted November 7, 2013 Posted November 7, 2013 You already did, but in that script, you are doing it twice, and wrong. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted November 7, 2013 Author Posted November 7, 2013 So is there anyway to fix it? 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.
pa3ck Posted November 7, 2013 Posted November 7, 2013 (edited) You could edit the server side code like this: setElementData ( source, "Rankicon", "_0.png" ) OR Edit the client side like this: if Level and fileExists ( Rankicon ) then dxDrawImage((557/1024)*sWidth, (745/768)*sHeight, size, size, Rankicon) Edited November 7, 2013 by Guest
Castillo Posted November 7, 2013 Posted November 7, 2013 addEventHandler ( "onClientRender", root, function ( ) local Rankicon = getElementData ( localPlayer, "Rankicon" ) if ( Rankicon and fileExists ( Rankicon ) ) then local size = dxGetFontHeight ( ( 0.7 / 1366 ) * sWidth, "bankgothic" ) dxDrawImage ( ( 557 / 1024 ) * sWidth, ( 745 / 768 ) * sHeight, size, size, Rankicon ) end end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted November 7, 2013 Author Posted November 7, 2013 dxDrawImage"Can't Load File" 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.
Castillo Posted November 8, 2013 Posted November 8, 2013 That's strange, since according to fileExists function, the file exists. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Dealman Posted November 8, 2013 Posted November 8, 2013 That's strange, since according to fileExists function, the file exists. Maybe fileOpen has to be used before-hand? I haven't really worked with those functions before, so just throwing a suggestion out there If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Castillo Posted November 8, 2013 Posted November 8, 2013 No, that's not required. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted November 8, 2013 Posted November 8, 2013 It doesn't make a difference, as far as I know. Edit: No, I was wrong, you can't use "\" instead of "/", but you can use "\\". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
-.Paradox.- Posted November 9, 2013 Author Posted November 9, 2013 Gonna try 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.
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