Newbie Posted February 9, 2014 Share Posted February 9, 2014 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
Castillo Posted February 9, 2014 Share Posted February 9, 2014 That's a real mess, it doesn't make much sense. Link to comment
Newbie Posted February 9, 2014 Author Share Posted February 9, 2014 That's a real mess, it doesn't make much sense. Where did i fail ? 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. Link to comment
Castillo Posted February 9, 2014 Share Posted February 9, 2014 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. Link to comment
Newbie Posted February 9, 2014 Author Share Posted February 9, 2014 (edited) . Edited February 9, 2014 by Guest Link to comment
Newbie Posted February 9, 2014 Author Share Posted February 9, 2014 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 ? Link to comment
myonlake Posted February 9, 2014 Share Posted February 9, 2014 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
Newbie Posted February 9, 2014 Author Share Posted February 9, 2014 Thanks i will try other way Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now