Jump to content

Custom level system is not working, help me please! :(


Recommended Posts

Posted

Hello guys! I've made a level script thingy, but when I try to check if it's working nothing happens. It's based on played hours on the server, I have 81 played hours, and it should output 'lol' to chatbox, but it's not working. What's the problem with my script?

function getLevel(playerSource) 
    local playedTime = (getElementData(playerSource, "hoursplayed") or 0) 
    --local currentLevel = (setElementData(playerSource, "playerlevel") or 0) 
     
    if playedTime then 
        local currentLevel = 0 
  
        if playedTime < 5 then 
            currentLevel = 1 
  
        elseif playedTime >= 5 and playedTime < 10 then 
            currentLevel = 2 
                 
        elseif playedTime >= 10 and playedTime < 15 then 
            currentLevel = 3 
  
-- and more ...  
  
                elseif playedTime >= 80 and playedTime < 85 then 
            currentLevel = 17 
            outputChatBox("lol") 
  
  
                 elseif playedTime >= 610 then 
            currentLevel = 100   
             
        end 
        return currentLevel 
    else 
        return false 
    end 
end 

Debugscript doesn't show errors.

Your signature image is too large.

Removed

Posted

Try checking whats the output of getElementData(playerSource, "hoursplayed").

My ingame nick is ~HyPeX~

BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager

gKhdyRJ.png

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