Jump to content

Doesn't work


Newbie

Recommended Posts

function getPlayerRank (thePlayer) 
local raceLoses = getAccountData( account,"Race Loses" ) <= 0 ) then 
setElementData(thePlayer(), "Rank") "Noob" ) 
elseif (getElementData(thePlayer(), "Race Loses") <= 5 ) then 
setElementData(thePlayer(), "Rank") "Better that noob" ) 
elseif (getElementData(thePlayer(), "Race Loses") <= 10 ) then 
setElementData(thePlayer(), "Rank") "Better than grinch" ) 
  
function checkPoints ( player ) 
    outputChatBox ( "rank: ".. Rank, player, 255, 255, 255 ) 
end 
addCommandHandler ( "rank", checkPoints ) 

I have 5 Race Loses, but the script doesn't do anything.

Where the problems ?

It should outputChatbox: rank: Better than noob

Link to comment

It cannot be explained any more easier, that's plain English and you should be able to understand that.

All functions have to be ended, your function is never ending and so you have to add an additional "end" there. There is no "account" variable, so you need to define one. There is no rank defined neither, so you need to do that. "thePlayer" is not a function, so you can take the brackets off of them, mind as well removing the first closing brackets on the setElementData functions.

You're also mixing getAccountData with getElementData. You also didn't open an if statement on the getAccountData part, so you have to do that. Keep in mind that you have to define the variable before the statement, in Lua you're not able to define varibles in statements (as far as I've tried).

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