Jump to content

[HELP] Please


1LoL1

Recommended Posts

Hello, how i can this:

now when i start the script in ScoreBoard i dont see Zombie Kills how i can see?

i mean

(getElementData(player, "Zombie Kills") or 0)

when i have 0 i dont see "0"

exports.scoreboard:addScoreboardColumn('Zombie Kills') 
  
addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",root, 
function (killer) 
setElementData(killer, "Zombie Kills", getElementData(killer, "Zombie Kills") + 1) 
end) 
  
  
function (player) 
getElementData(player, "Zombie Kills" or 0 
end 
addEventHandler("onResourceStart", root, 

Link to comment

The second function just doesn't make any sense.

addEvent("onZombieWasted",true) 
addEventHandler("onZombieWasted",root, 
function (killer) 
setElementData(killer, "Zombie Kills", getElementData(killer, "Zombie Kills") + 1) 
end) 
  
addEventHandler('onPlayerJoin', root, function() 
 setElementData(source, 'Zombie Kills', 0) 
end) 
  
addEventHandler('onResourceStart', root, function() 
 for index, player in pairs(getElementsByType('player')) do 
  setElementData(player, 'Zombie Kills', 0) 
 end 
end) 

Try to not use Zombie Kills as the element data, use something like 'zo' and a friendly name.

Link to comment
How are you going to see the kills if it's not set on join? Players without Zombie Kills as an element data will have an empty value for that column.

Try to explain better.

I have system when i quit Zombie Kills saved when Joined Zombie Kills loaded but i need when i restart script and anyone have 0 Zombie Kills i don't see Zombie Kills but when i have 1 and more i see normally.

Link to comment

When you restart the resource, you want everyone to have 0 as their kills? If so, the above code should still do that for you:

addEventHandler('onResourceStart', root, function() 
 for index, player in pairs(getElementsByType('player')) do 
  setElementData(player, 'Zombie Kills', 0) 
 end 
end) 

If you want anyone with 0 kills to have their kills cell empty, then just remove the element data on restart.

setElementData(player, 'Zombie Kills') 

Link to comment
When you restart the resource, you want everyone to have 0 as their kills? If so, the above code should still do that for you:
addEventHandler('onResourceStart', root, function() 
 for index, player in pairs(getElementsByType('player')) do 
  setElementData(player, 'Zombie Kills', 0) 
 end 
end) 

If you want anyone with 0 kills to have their kills cell empty, then just remove the element data on restart.

setElementData(player, 'Zombie Kills') 

ah yes i must use set to 0 so thanks. :D

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