Jump to content

[HELP] Why is this not working?


Recommended Posts

Posted (edited)

Ok, this is a rank system for my zombie server.

0 Errors, But when i kill 10 zombies i wont rank up?

And the text what supposed to be on the scoreboard is not on the scoreboard.

here is the code:

addEvent("onZombieWasted")
addEventHandler( "onZombieWasted", getRootElement(),
function (killer)
local player = getPlayerAccount ( killer )
local myRank = getAccountData(player,"rank")
             zombieKills = getAccountData(player, "zombieKills")        
if (zombieKills == "" or zombieKills == nil or zombieKills == false) then
              zombieKills = 0
end
if (look == "" or look == nil or look == false) 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)
end
 
givePlayerMoney (killer, 25);
setAccountData (player,"zombieKills",zombieKills+1)
 
if (getAccountData (player,"zombieKills") == 10) then
setAccountData (player,"rank","Trainee")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Trainee!")
outputChatBox ("Congratulations for your first rank! You get $500 as reward.",killer,0,255,0)
givePlayerMoney (killer,500)
elseif (getAccountData (player,"zombieKills") == 100) then
setAccountData (player,"rank","Beginner")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Beginner!")
outputChatBox ("Congratulations for your new rank! You get $1000 as reward.",killer,0,255,0)
givePlayerMoney (killer,1000)
elseif (getAccountData (player,"zombieKills") == 200) then
setAccountData (player,"rank","Survivor")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Survivor!")
outputChatBox ("Congratulations for your new rank! You get $2000 as reward.",killer,0,255,0)
givePlayerMoney (killer,2000)
elseif (getAccountData (player,"zombieKills") == 500) then
setAccountData (player,"rank","Expert")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Expert!")
outputChatBox ("Congratulations for your new rank! You get $5000 as reward.",killer,0,255,0)
givePlayerMoney (killer,5000)
elseif (getAccountData (player,"zombieKills") == 1000) then
setAccountData (player,"rank","Assassin")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Assassin!")
outputChatBox ("Congratulations for your new rank! You get $7000 as reward.",killer,0,255,0)
givePlayerMoney (killer,7000)
elseif (getAccountData (player,"zombieKills") == 5000) then
setAccountData (player,"rank","Master")
outputChatBox ("New rank! "..getPlayerName(killer).." Has been promoted to: Master!")
outputChatBox ("Congratulations! You have reached the last rank! You win: 1 000 000 !",killer,0,255,0)
givePlayerMoney (killer,1000000)
end
end
)

Regards,

Jesse

Edited by Guest
Posted

boards are reading values from element data (setElementData) not from account data

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

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