Jump to content

[HELP]Ranking system for everybody?


Recommended Posts

Hi, i remade Benxamix2's Ranking system

but when a player on my server kills a zombie i get 1 kill to?

here is the code:

addEvent("onZombieWasted")
addEventHandler( "onZombieWasted", getRootElement(),
function (killer)
 
local achievement1 = getAccountData(player,"Achievement: First Weapon")
local achievement2 = getAccountData(player,"Achievement: All Ranks")
local achievement3 = getAccountData(player,"Achievement: Million Dollar Man")
local achievement4 = getAccountData(player,"Achievement: All Achievements")
 
local player = getPlayerAccount ( killer )
local myRank = getAccountData(player,"rank")
local zombieKills = getAccountData(player, "zombieKills")
 
if (myRank == "" or myRank == nil or myRank == false) then
              myRank = "Coward"
end
if (zombieKills == "" or zombieKills == nil or zombieKills == false) then
              zombieKills = 0
end
if look == nil then
              look = 0
              display = textCreateDisplay()
textDisplayAddObserver (display,killer)
              kills = textCreateTextItem ("Kills: "..zombieKills,0.8,0.5,"medium",255,255,255,255,1.5)
              rank = textCreateTextItem ("Rank: "..myRank,0.8,0.53,"medium",255,255,255,255,1.5)
textDisplayAddText (display,kills)
textDisplayAddText (display,rank)
elseif look == 0 then
textItemSetText (kills,"Kills: "..zombieKills)
textItemSetText (rank,"Rank: "..myRank)
textItemSetText (kills,"Kills: "..zombieKills)
textItemSetText (rank,"Rank: "..myRank)
end
if (getPlayerMoney(killer) >= 100000) then
setAccountData (player,"Achievement: Million Dollar Man","true")
end
 
if achievement1 == true then
if achievement2 == false then
if achievement3 == false then
setAccountData(player,"Achievement: All Achievements","true")
end
end
end 
 
if getAccountData(player,"Achievement: All Achievements") then
setAccountData (player,"Permission to get out","true")
end
 
 
 
givePlayerMoney (killer, 25)
setAccountData (player,"zombieKills",zombieKills+1)
 
if (getAccountData (player,"zombieKills") == 10) then
setAccountData (player,"rank","Newbie")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Newbie")
outputChatBox ("Congratulations, You have been given 8000$ For your first rank!",killer,0,255,0)
givePlayerMoney (killer,8000)
elseif (getAccountData (player,"zombieKills") == 50) then
setAccountData (player,"rank","Killer")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Killer")
outputChatBox ("Congratulations, You have been given 4500$ For your new rank!",killer,0,255,0)
givePlayerMoney (killer,4500)
elseif (getAccountData (player,"zombieKills") == 500) then
setAccountData (player,"rank","Soldier")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Soldier")
outputChatBox ("Congratulations, You have been given 2300$ For your new rank!",killer,0,255,0)
givePlayerMoney (killer,2300)
elseif (getAccountData (player,"zombieKills") == 1000) then
setAccountData (player,"rank","Expert")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Expert")
outputChatBox ("Congratulations, You have been given 1700$ For your new rank!",killer,0,255,0)
givePlayerMoney (killer,1700)
elseif (getAccountData (player,"zombieKills") == 1800) then
setAccountData (player,"rank","Assassin")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Assassin")
outputChatBox ("Congratulations, You have been given 1200$ For your new rank!",killer,0,255,0)
givePlayerMoney (killer,1200)
elseif (getAccountData (player,"zombieKills") == 3000) then
setAccountData (player,"rank","General")
outputChatBox ("New rank! "..getPlayerName(killer).." Has reached max lvl: General !")
outputChatBox ("Congratulations, For your last rank you have been given: 20 000  MORE RANKS COMING SOON!",killer,0,255,0)
givePlayerMoney (killer,20000)
end
end
)

Link to comment

I hate long codes and I only checked your first 4 getAccountData lines which are wrong and you should get a warning message which you didn't say about... So, I guess you don't use debug window. Use "debugscript 3" command.

Link to comment

I noticed myself that there is an error.

local player = getPlayerAccount ( killer )
local achievement1 = getAccountData(player,"Achievement: First Weapon")
local achievement2 = getAccountData(player,"Achievement: All Ranks")
local achievement3 = getAccountData(player,"Achievement: Million Dollar Man")
local achievement4 = getAccountData(player,"Achievement: All Achievements")

"player" must be defined before using functions with it.

Oh, and ask me before using my resources, cause I can say you are stealing my work; there is no difference between this and the original, does it?

Bye.

Link to comment
I noticed myself that there is an error.
local player = getPlayerAccount ( killer )
local achievement1 = getAccountData(player,"Achievement: First Weapon")
local achievement2 = getAccountData(player,"Achievement: All Ranks")
local achievement3 = getAccountData(player,"Achievement: Million Dollar Man")
local achievement4 = getAccountData(player,"Achievement: All Achievements")

"player" must be defined before using functions with it.

Oh, and ask me before using my resources, cause I can say you are stealing my work; there is no difference between this and the original, does it?

Bye.

Ok, Sorry. i ask ^^

Link to comment
I noticed myself that there is an error.
local player = getPlayerAccount ( killer )
local achievement1 = getAccountData(player,"Achievement: First Weapon")
local achievement2 = getAccountData(player,"Achievement: All Ranks")
local achievement3 = getAccountData(player,"Achievement: Million Dollar Man")
local achievement4 = getAccountData(player,"Achievement: All Achievements")

"player" must be defined before using functions with it.

Oh, and ask me before using my resources, cause I can say you are stealing my work; there is no difference between this and the original, does it?

Bye.

Ain't you Maurize's scripter?

If yes: I know him he was admin on my server.

Link to comment
I noticed myself that there is an error.

Oh, and ask me before using my resources, cause I can say you are stealing my work; there is no difference between this and the original, does it?

Bye.

Ain't you Maurize's scripter?

If yes: I know him he was admin on my server.

that dosnt matter in my opinion, u should ask the owner of the resource if u can take a part from it...

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