Jump to content

Userpanel doesn't give money when i die


Recommended Posts

Hi all,

My userpanel doesn't give money when i die, someones can help me?

This is my script:

function earnMoneyForDeath(whatPosition,player) 
    if whatPosition == 1 then 
        if isPlayerLogged(player) then 
            local playerCount = #getElementsByType("player") 
            if infos.minPlayer <= playerCount then 
                local expToEarn = playerCount*5 
                local cashToEarn = playerCount*25 
                addDataValue ( player, "cash", cashToEarn) 
                addDataValue ( player, "points", expToEarn) 
                earnTeamExpAndCash(player,expToEarn,cashToEarn) 
                outputChatBox("[EARNED] #FFFFFF You won $"..cashToEarn.." and "..expToEarn.." points.",player,_r,_g,_b,true) 
            else 
                outputChatBox("[EARNED] #FFFFFF Minimum Players Required to Earn Points / Cash : "..infos.minPlayer..".",player,_r,_g,_b,true) 
            end 
        end 
    else 
        if isPlayerLogged(player) then 
            local playerCount = #getElementsByType("player") 
            if infos.minPlayer <= playerCount then 
                local expToEarn = (playerCount-whatPosition)*4 
                local cashToEarn = (playerCount-whatPosition)*20 
                addDataValue ( player, "cash", cashToEarn) 
                addDataValue ( player, "points", expToEarn) 
                earnTeamExpAndCash(player,expToEarn,cashToEarn) 
                outputChatBox("[EARNED] #FFFFFF You won $"..cashToEarn.." and "..expToEarn.." points.",player,_r,_g,_b,true) 
            else 
                outputChatBox("[EARNED] #FFFFFF Minimum Players Required to Earn Points / Cash "..infos.minPlayer..".",player,_r,_g,_b,true) 
            end 
        end 
    end 
end 
addEvent("onPlayerDeadInRace",true) 
addEventHandler("onPlayerDeadInRace",getRootElement(),earnMoneyForDeath) 

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