Jump to content

rank system


Recommended Posts

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

@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

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
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
Yeah :lol::lol::lol::lol::lol::lol::lol::lol:

@[sTM]Metalhero please dont make your own functions and better search in wiki.

and please use "getElementData" NOT "loadPlayerData" :wink:

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

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

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

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