Jump to content

Help, level up Dx or outputchatbox


side

Recommended Posts

Posted (edited)

Hello, sorry how can i create a  message when leveling up with the following system. 
Thank You !
 

addEvent("onZombieWasted",true)
addEventHandler("onZombieWasted",root,
function (killer)
    givePlayerMoney(killer,25)
    addPlayerZombieKills(killer)
 
end)


function addPlayerZombieKills(killer)
    local account = getPlayerAccount(killer)
    if isGuestAccount(account) then return end
    local zombieKills = getAccountData(account,"Zombie kills")
    if not zombieKills then setAccountData(account,"Zombie kills",0) end
    setAccountData(account,"Zombie kills",tonumber(zombieKills)+1)
end

addEventHandler("onPlayerLogin",root,
function ()
    local account = getPlayerAccount(source)
    if isGuestAccount(account) then return end
    local zombieKills = getAccountData(account,"Zombie kills")
    if zombieKills then
        setElementData(source,"Zombie kills",tostring(zombieKills))
    else
        setElementData(source,"Zombie kills",0)    
 
end
end
)

addEventHandler("onElementDataChange",root,
function() 
	if getElementType(source) == "player" then
    local zombiekills = getAccountData(getPlayerAccount(source) ,"Zombie kills") or 0
if (zombiekills >= 0) and (zombiekills <= 10) then 
setElementData(source,"Rango","Rank/1.png") 
elseif (zombiekills >= 11) and (zombiekills <= 99) then 
setElementData(source,"Rango","Rank/2.png") 
elseif (zombiekills >= 100) and (zombiekills <= 299) then 
setElementData(source,"Rango","Rank/3.png") 
elseif (zombiekills >= 300) and (zombiekills <= 499) then 
setElementData(source,"Rango","Rank/4.png") 
elseif (zombiekills >= 500) and (zombiekills <= 699) then 
setElementData(source,"Rango","Rank/5.png") 
elseif (zombiekills >= 700) and (zombiekills <= 1299) then 
setElementData(source,"Rango","Rank/6.png")
elseif (zombiekills >= 1300) and (zombiekills <= 1699) then 
setElementData(source,"Rango","Rank/7.png") 
elseif (zombiekills >= 1700) and (zombiekills <= 2099) then 
setElementData(source,"Rango","Rank/8.png") 
elseif (zombiekills >= 2100) and (zombiekills <= 4699) then 
setElementData(source,"Rango","Rank/9.png") 
elseif (zombiekills >= 4700) and (zombiekills <= 5399) then 
setElementData(source,"Rango","Rank/10.png")

elseif (zombiekills >= 5400) and (zombiekills <= 6399) then 
setElementData(source,"Rango","Rank/11.png") 
elseif (zombiekills >= 6400) and (zombiekills <= 7399) then 
setElementData(source,"Rango","Rank/12.png") 
elseif (zombiekills >= 7400) and (zombiekills <= 8399) then 
setElementData(source,"Rango","Rank/13.png") 
elseif (zombiekills >= 8400) and (zombiekills <= 9399) then 
setElementData(source,"Rango","Rank/14.png") 
elseif (zombiekills >= 9400) and (zombiekills <= 10399) then 
setElementData(source,"Rango","Rank/15.png") 
elseif (zombiekills >= 10400) and (zombiekills <= 11399) then 
setElementData(source,"Rango","Rank/16.png")
elseif (zombiekills >= 11400) and (zombiekills <= 13399) then 
setElementData(source,"Rango","Rank/17.png") 
elseif (zombiekills >= 13400) and (zombiekills <= 14399) then 
setElementData(source,"Rango","Rank/18.png") 
elseif (zombiekills >= 14400) and (zombiekills <= 15399) then 
setElementData(source,"Rango","Rank/19.png") 
elseif (zombiekills >= 15400) and (zombiekills <= 16399) then 
setElementData(source,"Rango","Rank/20.png")

elseif (zombiekills >= 16400) and (zombiekills <= 17399) then 
setElementData(source,"Rango","Rank/21.png") 
elseif (zombiekills >= 17400) and (zombiekills <= 18399) then 
setElementData(source,"Rango","Rank/22.png") 
elseif (zombiekills >= 18400) and (zombiekills <= 18999) then 
setElementData(source,"Rango","Rank/23.png") 
elseif (zombiekills >= 19400) and (zombiekills <= 20399) then 
setElementData(source,"Rango","Rank/24.png") 
elseif (zombiekills >= 20400) and (zombiekills <= 20999) then 
setElementData(source,"Rango","Rank/25.png") 
elseif (zombiekills >= 21000) and (zombiekills <= 22999) then 
setElementData(source,"Rango","Rank/26.png")
elseif (zombiekills >= 23000) and (zombiekills <= 24999) then 
setElementData(source,"Rango","Rank/27.png") 
elseif (zombiekills >= 25000) and (zombiekills <= 26999) then 
setElementData(source,"Rango","Rank/28.png") 
elseif (zombiekills >= 27000) and (zombiekills <= 28999) then 
setElementData(source,"Rango","Rank/29.png") 
elseif (zombiekills >= 29000) and (zombiekills <= 31999) then 
setElementData(source,"Rango","Rank/30.png")

elseif (zombiekills >= 32000) and (zombiekills <= 36999) then 
setElementData(source,"Rango","Rank/31.png") 
elseif (zombiekills >= 37000) and (zombiekills <= 41999) then 
setElementData(source,"Rango","Rank/32.png") 
elseif (zombiekills >= 42000) and (zombiekills <= 46999) then 
setElementData(source,"Rango","Rank/33.png") 
elseif (zombiekills >= 47000) and (zombiekills <= 49999) then 
setElementData(source,"Rango","Rank/34.png") 
elseif (zombiekills >= 50000) and (zombiekills <= 64999) then 
setElementData(source,"Rango","Rank/35.png") 
elseif (zombiekills >= 65000) and (zombiekills <= 70999) then 
setElementData(source,"Rango","Rank/36.png")
elseif (zombiekills >= 71000) and (zombiekills <= 76999) then 
setElementData(source,"Rango","Rank/37.png") 
elseif (zombiekills >= 77000) and (zombiekills <= 82999) then 
setElementData(source,"Rango","Rank/38.png") 
elseif (zombiekills >= 83000) and (zombiekills <= 88999) then 
setElementData(source,"Rango","Rank/39.png") 
elseif (zombiekills >= 89000) and (zombiekills <= 99899) then 
setElementData(source,"Rango","Rank/40.png")

elseif (zombiekills >= 99900) and (zombiekills <= 99999) then 
setElementData(source,"Rango","Rank/41.png") 
elseif (zombiekills >= 100000) and (zombiekills <= 119999) then 
setElementData(source,"Rango","Rank/42.png") 
elseif (zombiekills >= 120000) and (zombiekills <= 149999) then 
setElementData(source,"Rango","Rank/43.png") 
elseif (zombiekills >= 150000) and (zombiekills <= 179999) then 
setElementData(source,"Rango","Rank/44.png") 
elseif (zombiekills >= 180000) and (zombiekills <= 199999) then 
setElementData(source,"Rango","Rank/45.png") 
elseif (zombiekills >= 200000) and (zombiekills <= 219999) then 
setElementData(source,"Rango","Rank/46.png")
elseif (zombiekills >= 220000) and (zombiekills <= 239999) then 
setElementData(source,"Rango","Rank/47.png") 
elseif (zombiekills >= 240000) and (zombiekills <= 259999) then 
setElementData(source,"Rango","Rank/48.png") 
elseif (zombiekills >= 260000) and (zombiekills <= 289999) then 
setElementData(source,"Rango","Rank/49.png") 
elseif (zombiekills >= 290000) and (zombiekills <= 359999) then 
setElementData(source,"Rango","Rank/50.png")

elseif (zombiekills >= 360000) and (zombiekills <= 10000000) then 
setElementData(source,"Rango","Rank/51.png") 
end 
end 
end
 )

addEventHandler("onPlayerSpawn",root, 
function () 
    local cuenta = getPlayerAccount(source) 
    if isGuestAccount(cuenta) then return end 
    local rango = getAccountData(cuenta,"Rango") 
    if rango then 
        setElementData(source,"Rango", rango) 
    end 
end 
) 

 

Edited by side
  • side changed the title to Help, level up Dx or outputchatbox
Posted
On 10/09/2020 at 05:40, Tekken said:

Just add a outputChatBox after each if statement 

Sorry for the inconvenience, could you give me an example, i added the outputchatbox and it showed infinitely in the chat, i would appreciate. 

Posted

Well that’s because you start counting from the lowest to the highest if you start from the highest that’s should only output once

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