Jump to content

Doesn't work


Newbie

Recommended Posts

Posted
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

Posted
That's a real mess, it doesn't make much sense.

Where did i fail ? :D

I'ma tryin to make a rank system.

The script should get account data of Race Loses (another but working script)

And when player types /rank Show his rank.

Posted

In many ways it's wrong.

1. 'account' is not defined anywhere.

2. You ain't ending 'getPlayerRank' function.

3. In 'checkPoints' function, 'Rank' is not defined.

Posted
In many ways it's wrong.

1. 'account' is not defined anywhere.

2. You ain't ending 'getPlayerRank' function.

3. In 'checkPoints' function, 'Rank' is not defined.

1. It's defined in other file

2. :?:

3. :?:

Could you please explain easier ?

Posted

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

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