Jump to content

dxdrawImage [HELP] | PLSSSSSSS


yoya99

Recommended Posts

hi my friends... this is thje code of my dm lvl system and i would llike to draw an image for each single level...I tried many things out ...also in my seperate hud but it took no effect...maybe you can help me pls:

addEventHandler("onPlayerSpawn",root, 
function() 
    local account = getPlayerAccount(source) 
    local Rank = getAccountData(account, "LV") 
if tonumber(Rank) == 0 then 
setElementData(source,"Rank","ranks/lvl_0.png") 
elseif tonumber(Rank) == 1 then 
setElementData(source,"Rank","ranks/lvl_1.png") 
elseif tonumber(Rank) == 2 then 
setElementData(source,"Rank","ranks/lvl_2.png") 
elseif tonumber(Rank) == 3 then 
setElementData(source,"Rank","ranks/lvl_3.png") 
elseif tonumber(Rank) == 4 then 
setElementData(source,"Rank","ranks/lvl_4.png") 
elseif tonumber(Rank) == 5 then 
setElementData(source,"Rank","ranks/lvl_5.png") 
elseif tonumber(Rank) == 6 then 
setElementData(source,"Rank","ranks/lvl_6.png") 
elseif tonumber(Rank) == 7 then 
setElementData(source,"Rank","ranks/lvl_7.png") 
elseif tonumber(Rank) == 8 then 
setElementData(source,"Rank","ranks/lvl_8.png") 
elseif tonumber(Rank) == 9 then 
setElementData(source,"Rank","ranks/lvl_9.png") 
elseif tonumber(Rank) == 10 then 
setElementData(source,"Rank","ranks/lvl_10.png") 
elseif tonumber(Rank) == 11 then 
setElementData(source,"Rank","ranks/lvl_11.png") 
elseif tonumber(Rank) == 12 then 
setElementData(source,"Rank","ranks/lvl_12.png") 
elseif tonumber(Rank) == 13 then 
setElementData(source,"Rank","ranks/lvl_13.png") 
elseif tonumber(Rank) == 14 then 
setElementData(source,"Rank","ranks/lvl_14.png") 
elseif tonumber(Rank) == 15 then 
setElementData(source,"Rank","ranks/lvl_15.png") 
elseif tonumber(Rank) == 16 then 
setElementData(source,"Rank","ranks/lvl_16.png") 
elseif tonumber(Rank) == 17 then 
setElementData(source,"Rank","ranks/lvl_17.png") 
elseif tonumber(Rank) == 18 then 
setElementData(source,"Rank","ranks/lvl_18.png") 
elseif tonumber(Rank) == 19 then 
setElementData(source,"Rank","ranks/lvl_19.png") 
elseif tonumber(Rank) == 20 then 
setElementData(source,"Rank","ranks/lvl_20.png") 
elseif tonumber(Rank) == 21 then 
setElementData(source,"Rank","ranks/lvl_21.png") 
elseif tonumber(Rank) == 22 then 
setElementData(source,"Rank","ranks/lvl_22.png") 
elseif tonumber(Rank) == 23 then 
setElementData(source,"Rank","ranks/lvl_23.png") 
end 
end 
) 
  
addEventHandler("onPlayerSpawn",root, 
function () 
    local account = getPlayerAccount(source) 
    if isGuestAccount(account) then return end 
    local Emblems = getAccountData(account,"LV") 
    if emblems then 
        setElementData(source,"Emblems", emblems) 
end 
end 
) 

function win(ammo, killer, weapon, bodypart) 
    if (killer and getElementType(killer) == "player" and killer ~= source) then 
        local H = getElementData(killer, "XP") or 5 
        local S = getElementData(killer, "Level") 
        local killer1 = getPlayerName(killer) 
        local noob = getPlayerName(source) 
        local X = 1 
        setElementData(killer, "XP", tonumber(H)+X) 
        local H = tonumber(H) + X 
        if tonumber(H) == 2 then 
        setElementData(killer, "Level", "1") 
        elseif tonumber(H) == 5 then 
        setElementData(killer, "Level", "2") 
        elseif tonumber(H) == 10 then 
        setElementData(killer, "Level", "3") 
        elseif tonumber(H) == 15 then 
        setElementData(killer, "Level", "4") 
        elseif tonumber(H) == 25 then 
        setElementData(killer, "Level", "5") 
        elseif tonumber(H) == 30 then 
        setElementData(killer, "Level", "6") 
        elseif tonumber(H) == 45 then 
        setElementData(killer, "Level", "7") 
        elseif tonumber(H) == 55 then 
        setElementData(killer, "Level", "8") 
        elseif tonumber(H) == 65 then 
        setElementData(killer, "Level", "9") 
        elseif tonumber(H) == 70 then 
        setElementData(killer, "Level", "10") 
        elseif tonumber(H) == 75 then 
        setElementData(killer, "Level", "11") 
        elseif tonumber(H) == 85 then 
        setElementData(killer, "Level", "12") 
        elseif tonumber(H) == 100 then 
        setElementData(killer, "Level", "13") 
        elseif tonumber(H) == 115 then 
        setElementData(killer, "Level", "14") 
        elseif tonumber(H) == 130 then 
        setElementData(killer, "Level", "15") 
        elseif tonumber(H) == 145 then 
        setElementData(killer, "Level", "16") 
        elseif tonumber(H) == 155 then 
        setElementData(killer, "Level", "17") 
        elseif tonumber(H) == 160 then 
        setElementData(killer, "Level", "18") 
        elseif tonumber(H) == 170 then 
        setElementData(killer, "Level", "19") 
        elseif tonumber(H) == 180 then 
        setElementData(killer, "Level", "20") 
        elseif tonumber(H) == 200 then 
        setElementData(killer, "Level", "21") 
        elseif tonumber(H) == 250 then 
        setElementData(killer, "Level", "22") 
        elseif tonumber(H) == 300 then 
        setElementData(killer, "Level", "23") 
        elseif tonumber(H) == 400 then 
        setElementData(killer, "Level", "24") 
        elseif tonumber(H) == 450 then 
        setElementData(killer, "Level", "25") 
        elseif tonumber(H) == 600 then 
        setElementData(killer, "Level", "26") 
        elseif tonumber(H) == 650 then 
        setElementData(killer, "Level", "27") 
        elseif tonumber(H) == 750 then 
        setElementData(killer, "Level", "28") 
        elseif tonumber(H) == 830 then 
        setElementData(killer, "Level", "29") 
        elseif tonumber(H) == 900 then 
        setElementData(killer, "Level", "30") 
        elseif tonumber(H) == 970 then 
        setElementData(killer, "Level", "31") 
        elseif tonumber(H) == 10600 then 
        setElementData(killer, "Level", "32") 
        elseif tonumber(H) == 11111 then 
        setElementData(killer, "Level", "33") 
        elseif tonumber(H) == 20000 then 
        setElementData(killer, "Level", "34") 
        elseif tonumber(H) == 20500 then 
        setElementData(killer, "Level", "35") 
        elseif tonumber(H) == 40600 then 
        setElementData(killer, "Level", "36") 
        elseif tonumber(H) == 50000 then 
        setElementData(killer, "Level", "37") 
        elseif tonumber(H) == 51000 then 
        setElementData(killer, "Level", "38") 
        end 
    end 
end 
addEventHandler( "onPlayerWasted", getRootElement(), win) 
  
function onLogin (_,account) 
    setElementData(source, "Level", getAccountData(account, "LV") or "0") 
    setElementData(source, "XP", getAccountData(account, "EXP") or "0") 
end 
addEventHandler ("onPlayerLogin", root, onLogin) 
  
function saveData(thePlayer, theAccount) 
local theAccount = getPlayerAccount(source) 
    if (theAccount and not isGuestAccount(theAccount)) then 
        setAccountData (theAccount, "LV", getElementData(thePlayer, "Level")) 
        setAccountData (theAccount, "EXP", getElementData(thePlayer, "XP")) 
    end 
end 
  
addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) 
addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) 
  
  
  

Is it possible too to delete the parts from the hud to draw the image and make a seperate filefor that? pls help me...i want it to draw an image at the bottom of screen for every level :(

Link to comment

 if XP then

    dxDrawText("XP: "..XP, (336/1024)*sWidth, (745/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.85/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true)

    end

    if Level then

    dxDrawText("LV: "..Level, (466/1024)*sWidth, (745/768)*sHeight, (289/1024)*sWidth, (250/768)*sHeight, tocolor (255, 255, 255, 255), (0.85/1366)*sWidth,(0.9/768)*sHeight,"bankgothic","left","top",false,false,false,true)

    end

    if emblems and fileExists ( ":experiences/ranks/lvl_"..Rank..".png" ) then

    size = dxGetFontHeight((0.7/1366)*sWidth, "bankgothic")

    dxDrawImage((557/1024)*sWidth, (745/768)*sHeight, size, size, ":experiences/ranks/lvl_"..Rank..".png")I tried to add this in my hud:

Link to comment

function win(ammo, killer, weapon, bodypart)

    if (killer and getElementType(killer) == "player" and killer ~= source) then

        local H = getElementData(killer, "XP") or 5

        local S = getElementData(killer, "Level")

        local killer1 = getPlayerName(killer)

        local noob = getPlayerName(source)

        local X = 1

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...