Jump to content

ranks icon


mr.Extreme

Recommended Posts

Posted

use:

[url=https://wiki.multitheftauto.com/wiki/GuiCreateStaticImage]https://wiki.multitheftauto.com/wiki/Gu ... taticImage[/url] 
[url=https://wiki.multitheftauto.com/wiki/OnClientRender]https://wiki.multitheftauto.com/wiki/OnClientRender[/url] 

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

  • MTA Team
Posted

guiCreateStaticImage doesn't need onClientRender.

And if you want to use it to update the image, there are better events that don't use that kind of resources.

DevOps Engineer, Cloud Advocate & Security Engineer(Red Team) | Coffee, Containers & Burp

 
Posted
guiCreateStaticImage doesn't need onClientRender.

And if you want to use it to update the image, there are better events that don't use that kind of resources.

onClientRender not To Static Image :3 but to check if got Promote and etc

Giving a Fuck? Nope, That isn't in My Skill Set

castie11.png

  • Moderators
Posted
guiCreateStaticImage doesn't need onClientRender.

And if you want to use it to update the image, there are better events that don't use that kind of resources.

onClientRender not To Static Image :3 but to check if got Promote and etc

Of course, why checking this every 1 sec with a regular setTimer or a custom event when you can use onClientRender to check it every 33ms (at 30FPS) :wink:

No seriously, it's not that important to be updated every 33secs or under.

And I don't want to act as the bad guy, but some members doesn't get the difference between helping with scripts and asking for scripts. I'm pretty sure most of you will get what I mean.

Best regards,

Citizen

The rEvolution is coming ...

Posted

what the problem here ..... >.<

addEventHandler("onPlayerSpawn",root, 
function() 
    local account = getPlayerAccount(source) 
    local LEVELZOMBIES = getElementData(account, "Level") 
if (LEVELZOMBIES >= 0) and (LEVELZOMBIES <= 1) then 
setElementData(source,"Rankicon","ranks/lvl_0.png") 
elseif (LEVELZOMBIES >= 1) and ( LEVELZOMBIES <= 2)then 
setElementData(source,"Rankicon","ranks/lvl_1.png") 
elseif (LEVELZOMBIES >= 2) and (LEVELZOMBIES <= 4) then 
setElementData(source,"Rankicon","ranks/lvl_2.png") 
elseif (LEVELZOMBIES >= 4) and (LEVELZOMBIES <= 6) then 
setElementData(source,"Rankicon","ranks/lvl_3.png") 
elseif (LEVELZOMBIES >= 6) and (LEVELZOMBIES <= -- s8) --> then 
setElementData(source,"Rankicon","ranks/lvl_4.png") 
elseif (LEVELZOMBIES >= -- s8) --> and (LEVELZOMBIES <= 10)then 
setElementData(source,"Rankicon","ranks/lvl_5.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,"Rankicon", Emblems) 
end 
end 
) 

Posted

What is the problem? does it output errors in the debugscript?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

u can make like this

addEventHandler("onClientRender", root, 
function() 
    local LEVELZOMBIES = getElementData(localPlayer, "Level") 
    dxDrawImage(100, 100, 500, 500, "ranks/lvl_"..tostring(LEVELZOMBIES)..".png") 
end) 

Omerta Roleplay

Posted

no there Error in debugscript 3

client:

  
local rankicon = getElementData ( localPlayer, "Rankicon" ) 
if ( rankicon and fileExists ( rankicon ) ) then 
        dxDrawImage(sWidth*(820/1024), sHeight*(213/768), sWidth*(34/1024), sHeight*(34/768), rankicon, 0, 0, 0, tocolor(255, 255, 255, 255), false) 
        end 
  
  

client:

  
addEventHandler("onPlayerSpawn",root, 
function() 
    local account = getPlayerAccount(source) 
    local LEVELZOMBIES = getElementData(account, "Level") 
if (LEVELZOMBIES >= 0) and (LEVELZOMBIES <= 1) then 
setElementData(source,"Rankicon","ranks/lvl_0.png") 
elseif (LEVELZOMBIES >= 1) and (LEVELZOMBIES <= 2)then 
setElementData(source,"Rankicon","ranks/lvl_1.png") 
elseif (LEVELZOMBIES >= 2) and (LEVELZOMBIES <= 4) then 
setElementData(source,"Rankicon","ranks/lvl_2.png") 
elseif (LEVELZOMBIES >= 4) and (LEVELZOMBIES <= 6) then 
setElementData(source,"Rankicon","ranks/lvl_3.png") 
elseif (LEVELZOMBIES >= 6) and (LEVELZOMBIES <= -- s8) --> then 
setElementData(source,"Rankicon","ranks/lvl_4.png") 
elseif (LEVELZOMBIES >= -- s8) --> and (LEVELZOMBIES <= 10)then 
setElementData(source,"Rankicon","ranks/lvl_5.png") 
elseif (LEVELZOMBIES >= 10) and (LEVELZOMBIES <= 12) then 
setElementData(source,"Rankicon","ranks/lvl_6.png") 
elseif (LEVELZOMBIES >= 12) and (LEVELZOMBIES <= 14) then 
setElementData(source,"Rankicon","ranks/lvl_7.png") 
elseif (LEVELZOMBIES >= 14) and (LEVELZOMBIES <= 16) then 
setElementData(source,"Rankicon","ranks/lvl_8.png") 
elseif (LEVELZOMBIES >= 16) and (LEVELZOMBIES <= 18) then 
setElementData(source,"Rankicon","ranks/lvl_9.png") 
elseif (LEVELZOMBIES >= 18) and (LEVELZOMBIES <= 20) then 
setElementData(source,"Rankicon","ranks/lvl_10.png") 
elseif (LEVELZOMBIES >= 20) and (LEVELZOMBIES <= 22) then 
setElementData(source,"Rankicon","ranks/lvl_11.png") 
elseif (LEVELZOMBIES >= 22) and (LEVELZOMBIES <= 24) then 
setElementData(source,"Rankicon","ranks/lvl_12.png") 
elseif (LEVELZOMBIES >= 24) and (LEVELZOMBIES <= 26) then 
setElementData(source,"Rankicon","ranks/lvl_13.png") 
elseif (LEVELZOMBIES >= 26) and (LEVELZOMBIES <= 28) then 
setElementData(source,"Rankicon","ranks/lvl_14.png") 
elseif (LEVELZOMBIES >= 28) and (LEVELZOMBIES <= 30) then 
setElementData(source,"Rankicon","ranks/lvl_15.png") 
elseif (LEVELZOMBIES >= 30) and (LEVELZOMBIES <= 32) then 
setElementData(source,"Rankicon","ranks/lvl_16.png") 
elseif (LEVELZOMBIES >= 32) and (LEVELZOMBIES <= 34) then 
setElementData(source,"Rankicon","ranks/lvl_17.png") 
elseif (LEVELZOMBIES >= 34) and (LEVELZOMBIES <= 36) then 
setElementData(source,"Rankicon","ranks/lvl_18.png") 
elseif (LEVELZOMBIES >= 36) and (LEVELZOMBIES <= 38) then 
setElementData(source,"Rankicon","ranks/lvl_19.png") 
elseif (LEVELZOMBIES >= 38) and (LEVELZOMBIES <= 40) then 
setElementData(source,"Rankicon","ranks/lvl_20.png") 
elseif (LEVELZOMBIES >= 40) and (LEVELZOMBIES <= 42) then 
setElementData(source,"Rankicon","ranks/lvl_21.png") 
elseif (LEVELZOMBIES >= 42) and (LEVELZOMBIES <= 44) then 
setElementData(source,"Rankicon","ranks/lvl_22.png") 
elseif (LEVELZOMBIES >= 46) and (LEVELZOMBIES <= 48) then 
setElementData(source,"Rankicon","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,"Rankicon", Emblems) 
end 
end 
) 

  • Moderators
Posted

You have to use your setElementData for "Level" on the player element and not the account element to use the code from WASSIm. Please post here the code where you are using setElementData function for "Level".

The rEvolution is coming ...

Posted

client:

addEventHandler("onPlayerSpawn",root, 
function() 
    local account = getPlayerAccount(source) 
    local LEVELZOMBIES = getElementData(account, "Level") 
if (LEVELZOMBIES >= 0) and (LEVELZOMBIES <= 1) then 
setElementData(source,"Rankicon","ranks/lvl_0.png") 
elseif (LEVELZOMBIES >= 1) and (LEVELZOMBIES <= 2)then 
setElementData(source,"Rankicon","ranks/lvl_1.png") 
elseif (LEVELZOMBIES >= 2) and (LEVELZOMBIES <= 4) then 
setElementData(source,"Rankicon","ranks/lvl_2.png") 
elseif (LEVELZOMBIES >= 4) and (LEVELZOMBIES <= 6) then 
setElementData(source,"Rankicon","ranks/lvl_3.png") 
elseif (LEVELZOMBIES >= 6) and (LEVELZOMBIES <= -- s8) --> then 
setElementData(source,"Rankicon","ranks/lvl_4.png") 
elseif (LEVELZOMBIES >= -- s8) --> and (LEVELZOMBIES <= 10)then 
setElementData(source,"Rankicon","ranks/lvl_5.png") 
elseif (LEVELZOMBIES >= 10) and (LEVELZOMBIES <= 12) then 
setElementData(source,"Rankicon","ranks/lvl_6.png") 
elseif (LEVELZOMBIES >= 12) and (LEVELZOMBIES <= 14) then 
setElementData(source,"Rankicon","ranks/lvl_7.png") 
elseif (LEVELZOMBIES >= 14) and (LEVELZOMBIES <= 16) then 
setElementData(source,"Rankicon","ranks/lvl_8.png") 
elseif (LEVELZOMBIES >= 16) and (LEVELZOMBIES <= 18) then 
setElementData(source,"Rankicon","ranks/lvl_9.png") 
elseif (LEVELZOMBIES >= 18) and (LEVELZOMBIES <= 20) then 
setElementData(source,"Rankicon","ranks/lvl_10.png") 
elseif (LEVELZOMBIES >= 20) and (LEVELZOMBIES <= 22) then 
setElementData(source,"Rankicon","ranks/lvl_11.png") 
elseif (LEVELZOMBIES >= 22) and (LEVELZOMBIES <= 24) then 
setElementData(source,"Rankicon","ranks/lvl_12.png") 
elseif (LEVELZOMBIES >= 24) and (LEVELZOMBIES <= 26) then 
setElementData(source,"Rankicon","ranks/lvl_13.png") 
elseif (LEVELZOMBIES >= 26) and (LEVELZOMBIES <= 28) then 
setElementData(source,"Rankicon","ranks/lvl_14.png") 
elseif (LEVELZOMBIES >= 28) and (LEVELZOMBIES <= 30) then 
setElementData(source,"Rankicon","ranks/lvl_15.png") 
elseif (LEVELZOMBIES >= 30) and (LEVELZOMBIES <= 32) then 
setElementData(source,"Rankicon","ranks/lvl_16.png") 
elseif (LEVELZOMBIES >= 32) and (LEVELZOMBIES <= 34) then 
setElementData(source,"Rankicon","ranks/lvl_17.png") 
elseif (LEVELZOMBIES >= 34) and (LEVELZOMBIES <= 36) then 
setElementData(source,"Rankicon","ranks/lvl_18.png") 
elseif (LEVELZOMBIES >= 36) and (LEVELZOMBIES <= 38) then 
setElementData(source,"Rankicon","ranks/lvl_19.png") 
elseif (LEVELZOMBIES >= 38) and (LEVELZOMBIES <= 40) then 
setElementData(source,"Rankicon","ranks/lvl_20.png") 
elseif (LEVELZOMBIES >= 40) and (LEVELZOMBIES <= 42) then 
setElementData(source,"Rankicon","ranks/lvl_21.png") 
elseif (LEVELZOMBIES >= 42) and (LEVELZOMBIES <= 44) then 
setElementData(source,"Rankicon","ranks/lvl_22.png") 
elseif (LEVELZOMBIES >= 44) and (LEVELZOMBIES <= 46) then 
setElementData(source,"Rankicon","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,"Rankicon", Emblems) 
end 
end 
) 

server:

function win(killer, weapon, bodypart) 
    if (killer and getElementType(killer) == "player" and killer ~= source) then 
        local H = getElementData(killer, "XP") or 0 
        local S = getElementData(killer, "Level") 
        local killer1 = getPlayerName(killer) 
        local noob = getPlayerName(source) 
        local X = 5 
        setElementData(killer, "XP", tonumber(H)+X) 
        local H = tonumber(H) + X 
        if tonumber(H) == 100 then 
        setElementData(killer, "Level", "1") 
        elseif tonumber(H) == 200 then 
        setElementData(killer, "Level", "2") 
        elseif tonumber(H) == 300 then 
        setElementData(killer, "Level", "3") 
        elseif tonumber(H) == 400 then 
        setElementData(killer, "Level", "4") 
        elseif tonumber(H) == 1000 then 
        setElementData(killer, "Level", "5") 
        elseif tonumber(H) == 1200 then 
        setElementData(killer, "Level", "6") 
        elseif tonumber(H) == 1400 then 
        setElementData(killer, "Level", "7") 
        elseif tonumber(H) == 1600 then 
        setElementData(killer, "Level", "8") 
        elseif tonumber(H) == 1800 then 
        setElementData(killer, "Level", "9") 
        elseif tonumber(H) == 2000 then 
        setElementData(killer, "Level", "10") 
        elseif tonumber(H) == 2200 then 
        setElementData(killer, "Level", "11") 
        elseif tonumber(H) == 2400 then 
        setElementData(killer, "Level", "12") 
        elseif tonumber(H) == 2600 then 
        setElementData(killer, "Level", "13") 
        elseif tonumber(H) == 2800 then 
        setElementData(killer, "Level", "14") 
        elseif tonumber(H) == 4000 then 
        setElementData(killer, "Level", "15") 
        elseif tonumber(H) == 4200 then 
        setElementData(killer, "Level", "16") 
        elseif tonumber(H) == 4400 then 
        setElementData(killer, "Level", "17") 
        elseif tonumber(H) == 4600 then 
        setElementData(killer, "Level", "18") 
        elseif tonumber(H) == 4800 then 
        setElementData(killer, "Level", "19") 
        elseif tonumber(H) == 4900 then 
        setElementData(killer, "Level", "20") 
        elseif tonumber(H) == 7000 then 
        setElementData(killer, "Level", "21") 
        elseif tonumber(H) == 9000 then 
        setElementData(killer, "Level", "22") 
        elseif tonumber(H) == 10000 then 
        setElementData(killer, "Level", "23") 
        elseif tonumber(H) == 12000 then 
        setElementData(killer, "Level", "24") 
        elseif tonumber(H) == 13000 then 
        setElementData(killer, "Level", "25") 
        elseif tonumber(H) == 14000 then 
        setElementData(killer, "Level", "26") 
        elseif tonumber(H) == 15000 then 
        setElementData(killer, "Level", "27") 
        elseif tonumber(H) == 16000 then 
        setElementData(killer, "Level", "28") 
        elseif tonumber(H) == 17000 then 
        setElementData(killer, "Level", "29") 
        elseif tonumber(H) == 20000 then 
        setElementData(killer, "Level", "30") 
        end 
    end 
end 
addEventHandler( "onZombieWasted", getRootElement(), win) 
  
function onLogin (_,account) 
    setElementData(source, "Level", getAccountData(account, "LV") or "LV 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) 
  
  
addCommandHandler ( "setxp", 
    function ( thePlayer, _, who, XP ) 
        local XP = tonumber ( XP ) or 0 
        local ThePlayer = getPlayerFromName ( who ) 
        if ( ThePlayer ) then 
           setElementData( ThePlayer,"XP",XP ) 
        end 
    end 
) 
  
  
  
  
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        setElementData ( source, "Rankicon",":ranks\\lvl_0.png" ) 
    end 
) 
  
addEventHandler ( "onPlayerLogin", root, 
function () 
local account = getPlayerAccount(source) 
local Level = getAccountData(account, "LV") 
    if isGuestAccount ( account ) then 
        setElementData(source, "Rankicon",":ranks\\lvl_0.png") 
    else 
        setElementData(source, "Rankicon", tostring(":ranks\\lvl_"..Level..".png" ))                                       
    end 
end 
) 

Posted

Both are server side...

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.

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...