1LoL1 Posted September 21, 2015 Share Posted September 21, 2015 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
JR10 Posted September 21, 2015 Share Posted September 21, 2015 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
1LoL1 Posted September 21, 2015 Author Share Posted September 21, 2015 Ehm but i don't want set to 0 i want only when i start resource i want see Zombie Kills and when i have 0 i want to see 0 or when join. Link to comment
JR10 Posted September 21, 2015 Share Posted September 21, 2015 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. Link to comment
1LoL1 Posted September 21, 2015 Author Share Posted September 21, 2015 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
JR10 Posted September 21, 2015 Share Posted September 21, 2015 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
1LoL1 Posted September 21, 2015 Author Share Posted September 21, 2015 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. 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