[STM]Metalhero Posted June 29, 2010 Share Posted June 29, 2010 I want write a rank sytem but i have no idea what i must make to finish function rank (player) local p = loadPlayerData (source,"points") local r1 = "Newbie" local r2 = "Guest" local r3 = "Player" local r4 = "Known" local r5 = "Friend" local r6 = "V.I.P" local r7 = "Famous" local r8 = "Pro" local r9 = "Crazy" local r10 = "Insane" if local r10 = (p <= 100000) then else local r9 = (p <= 50000) else local r8 = (p <= 10000) else local r7 = (p <= 5000) else local r6 = (p <= 2000) else local r5 = (p <= 1000) else local r4 = (p <= 500) else local r3 = (p <= 250) else local r2 = (p <= 100) else local r1 = (p <= 50) end end Link to comment
dzek (varez) Posted June 29, 2010 Share Posted June 29, 2010 and what you want to count? kills? race win? i wont help you. im BORED with people who dont want to learn something, just keep begging for more and more Link to comment
loler Posted June 30, 2010 Share Posted June 30, 2010 1. Its getElementData NOT loadElementData 2.Is this a script? no , i dont think so wait im making it in 5 min 3. it isnt "local r1" or " local r2" use insteand "r1" or "r2" Link to comment
loler Posted June 30, 2010 Share Posted June 30, 2010 function getPlayerRank (thePlayer) if (getElementData(getLocalPlayer(), "Points") <= 0 ) then setElementData(getLocalPlayer(), "Rank") "Newbie" ) elseif (getElementData(getLocalPlayer(), "Points") <= 100 ) then setElementData(getLocalPlayer(), "Rank") "Guest" ) elseif (getElementData(getLocalPlayer(), "Points") <=250 ) then setElementData(getLocalPlayer(), "Rank") "Player" ) elseif (getElementData(getLocalPlayer(), "Points") <= 500 ) then setElementData(getLocalPlayer(), "Rank") "Known" ) elseif (getElementData(getLocalPlayer(), "Points") <= 1000 ) then setElementData(getLocalPlayer(), "Rank") "Server friend" ) elseif (getElementData(getLocalPlayer(), "Points") <= 2500 ) then setElementData(getLocalPlayer(), "Rank") "V.I.P" ) elseif (getElementData(getLocalPlayer(), "Points") <= 5000 ) then setElementData(getLocalPlayer(), "Rank") "Faumos" ) elseif (getElementData(getLocalPlayer(), "Points") <= 10000 ) then setElementData(getLocalPlayer(), "Rank") "Pro" ) elseif (getElementData(getLocalPlayer(), "Points") <= 50000 ) then setElementData(getLocalPlayer(), "Rank") "Crazy" ) elseif (getElementData(getLocalPlayer(), "Points") <= 1000000 ) then setElementData(getLocalPlayer(), "Rank") "Insane" ) and for see the rank prepare some $$ and i dont know when there are good that "" from ranks (("Insane") , etc ) and Warning its untested Link to comment
MaddDogg Posted June 30, 2010 Share Posted June 30, 2010 @loler: You should know that you're actually not helping him in the long run. It is very kindful of you to write that for him (although you should have used loops), but he will just come back with more questions like "i want this thing, here is my 3 lines code, finish it". @Metalhero: You should DEFINITELY read more tutorials about scripting (in Lua/MTA), because you didn't even have any idea to start. That won't get you far, even with someone, who writes you a code snippet. You didn't even define your rank system. What do you want it to do? Where do you need help? You can't just ask here for a complete rank system script.. You should've started out with thinking about what you need for the system. That could be a function, which raises the points, a function, which returns the rank... Link to comment
[STM]Metalhero Posted July 1, 2010 Author Share Posted July 1, 2010 i need help agian but it not add to stats and save in my List elseif (string.find(message,"!stats")) and not (string.find(message," !stats")) then local playerCash = loadPlayerData (source,"cash") local playerPoints = loadPlayerData (source,"points") local playerRank = loadPlayerData (source,"Rank") setTimer(outputChatBox,50,1,getPlayerName (source) .. " #ffd700has " .. tostring(playerCash) .. "$ and " .. tostring(playerPoints) .. " points! He is Rank " .. tostring(playerRank) .. "!",getRootElement(),255,0,0,true) function getPlayerRank (thePlayer) local Points = loadPlayerData (source,"points") if (getPlayerData(getLocalPlayer(), "Points") <= 0 ) then setPlayerData(getLocalPlayer(), "Rank") "Newbie" elseif (getPlayerData(getLocalPlayer(), "Points") <= 100 ) then setPlayerData(getLocalPlayer(), "Rank") "Guest" elseif (getPlayerData(getLocalPlayer(), "Points") <=250 ) then setPlayerData(getLocalPlayer(), "Rank") "Player" elseif (getPlayerData(getLocalPlayer(), "Points") <= 500 ) then setPlayerData(getLocalPlayer(), "Rank") "Known" elseif (getPlayerData(getLocalPlayer(), "Points") <= 1000 ) then setPlayerData(getLocalPlayer(), "Rank") "Server friend" elseif (getPlayerData(getLocalPlayer(), "Points") <= 2500 ) then setPlayerData(getLocalPlayer(), "Rank") "V.I.P" elseif (getPlayerData(getLocalPlayer(), "Points") <= 5000 ) then setPlayerData(getLocalPlayer(), "Rank") "Faumos" elseif (getPlayerData(getLocalPlayer(), "Points") <= 10000 ) then setPlayerData(getLocalPlayer(), "Rank") "Pro" elseif (getPlayerData(getLocalPlayer(), "Points") <= 50000 ) then setPlayerData(getLocalPlayer(), "Rank") "Crazy" elseif (getPlayerData(getLocalPlayer(), "Points") <= 1000000 ) then setPlayerData(getLocalPlayer(), "Rank") "Insane" savePlayerData (getLocalPlayer(),"rank",Player(getLocalPlayer(),"Rank")) end end Link to comment
loler Posted July 1, 2010 Share Posted July 1, 2010 elseif (string.find(message,"!stats")) and not (string.find(message," !stats")) then local playerCash = getElementData (source,"cash") local playerPoints = getElementData (source,"points") local playerRank = getElementData (source,"Rank") setTimer(outputChatBox,50,1,getPlayerName (source) .. " #ffd700has " .. tostring(playerCash) .. "$ and " .. tostring(playerPoints) .. " points! He is Rank " .. tostring(playerRank) .. "!",getRootElement(),255,0,0,true) As i said its "getElementData" not "loadPlayerData" and this is the last time that i help you Link to comment
Spider Pork Posted July 1, 2010 Share Posted July 1, 2010 As i said its "getElementData" not "loadPlayerData" What if he created his own function ? Link to comment
loler Posted July 1, 2010 Share Posted July 1, 2010 Yeah @[sTM]Metalhero please dont make your own functions and better search in wiki. and please use "getElementData" NOT "loadPlayerData" Link to comment
50p Posted July 1, 2010 Share Posted July 1, 2010 Yeah @[sTM]Metalhero please dont make your own functions and better search in wiki. and please use "getElementData" NOT "loadPlayerData" OMG! Who says that? Someone who doesn't look at the wiki at all... Don't tell him not to make his own function because you have no idea what you're talking about. Link to comment
dzek (varez) Posted July 1, 2010 Share Posted July 1, 2010 at least after 2 month kevin11 KNOW SOMETHING! That's big thing Link to comment
[STM]Metalhero Posted July 8, 2010 Author Share Posted July 8, 2010 now i fix a bit now came ...is Rank false elseif (string.find(message,"!stats")) and not (string.find(message," !stats")) then local playerCash = loadPlayerData (source,"cash") local playerPoints = loadPlayerData (source,"points") local playerRank = getElementData (source,"Rank") setTimer(outputChatBox,50,1,getPlayerName (source) .. " #ffd700has " .. tostring(playerCash) .. "$ and " .. tostring(playerPoints) .. " points! He is Rank " .. tostring(playerRank) function getPlayerRank (thePlayer) local Points = loadPlayerData (source,"points") if (Points <= 0 ) then setElementData(getLocalPlayer(), "Rank") "1.Newbie" elseif (Points <= 100 ) then setElementData(getLocalPlayer(), "Rank") "2.Guest" elseif (Points <=250 ) then setElementData(getLocalPlayer(), "Rank") "3.Player" elseif (Points <= 500 ) then setElementData(getLocalPlayer(), "Rank") "4.Known" elseif (Points <= 1000 ) then setElementData(getLocalPlayer(), "Rank") "5.Server friend" elseif (Points <= 2500 ) then setElementData(getLocalPlayer(), "Rank") "6.V.I.P" elseif (Points <= 5000 ) then setElementData(getLocalPlayer(), "Rank") "7.Faumos" elseif (Points <= 10000 ) then setElementData(getLocalPlayer(), "Rank") "8.Pro" elseif (Points <= 50000 ) then setElementData(getLocalPlayer(), "Rank") "9.Crazy" elseif (Points <= 1000000 ) then setElementData(getLocalPlayer(), "Rank") "10.Insane" end end Link to comment
MaddDogg Posted July 8, 2010 Share Posted July 8, 2010 It looks like, you didn't use the getPlayerRank function to set the element data "Rank". Then, of course, getElementData will return false. The code is still very messy, but okay, that's your problem. Link to comment
MaddDogg Posted July 8, 2010 Share Posted July 8, 2010 Do you even understand your script? Your getPlayerRank function seems to set the element data. Then you can get this data. Although this system is kinda weird and inconvenient, it should work. Again, you have to use your getPlayerRank function FIRST and then you can get the element data for the rank. Link to comment
[STM]Metalhero Posted July 8, 2010 Author Share Posted July 8, 2010 i dont check this fuction stand first 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