triplesnake Posted August 21, 2011 Share Posted August 21, 2011 soo i got that dx scoreboard edited it a bit but i was wondering if someone can help me make scores for it like kills deathes and stuff Link to comment
SHC//Sniper Posted August 21, 2011 Share Posted August 21, 2011 Hey, next time please try to use full stops and capital letters, this will higher your chances of getting a good answere. If you don't care about your topic, others won't do that as well. It would be useful for us if you provide more info about what you need. The management of the dxScoreboard is described in the Wiki very well. You will need the function bool scoreboardAddColumn ( string name, [ element forElement = getRootElement(), int width = 70, string friendlyName = name, int priority = slot after "name" column ] ) to add a column. Also remember that this function must be exported if used from another resource. You can set the scoreboard data with setElementData: setElementData ( thePlayer, "wanted level", 3 ) --3 is inserted in the player's wanted level column The column for the "wanted level" would be (using it as exported function): exports.dxscoreboard.scoreboardAddColumn("wanted level", getRootElement(), 70, "wanted") Now use your lua skills and use that for kills, deaths etc. Nobody is going to give you a full script here. Greets Sniper Link to comment
triplesnake Posted August 21, 2011 Author Share Posted August 21, 2011 First thank you a lot. Second so i want to make a coloumn to kills i do this bool scoreboardAddColumn ( string name, [ element forElement = getRootElement(), int width = 70, string friendlyName = kills, int priority = slot after "name" column ] ) setElementData ( thePlayer, "kills", 3 ) --3 is inserted in the player's wanted level column exports.dxscoreboard.scoreboardAddColumn("kills", getRootElement(), 70, "kills") or what?? please help i am still learning and its sort of hard Link to comment
SHC//Sniper Posted August 21, 2011 Share Posted August 21, 2011 This script will display the kills a player has made in his session. They are not saved forever. --/////////////////////////////-- ----------By SHC//Sniper--------- --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\-- addEventHandler("onResourceStart", getResourceRootElement(), function () --at first we create the additional column when the scripts is being started --NOTE: the resource of the scoreboard must be "dxscoreboard" otherwise it won't work exports.dxscoreboard.scoreboardAddColumn("kills", getRootElement(), 70, "kills") --now we check if the player already has some data saved for i,v in ipairs(getElementsByType("player")) do --loop through all players local data = getElementData(v, "kills") --get the data "kills" if (data) then --if there is no data setElementData(v, "kills", 0) --we reset the "kills" to 0 end end end) --the easy function to add +1 kill function addScoreKill(player) if (player) and (getElementType(player) == "player") then --check if the argument is valid local data = tonumber(getElementData(player, "kills")) --get the current amount of kills setElementData(player, "kills", data + 1) --finally add the kill end end --set players kills to 0 after joining addEventHandler("onPlayerJoin", getRootElement(), function() setElementData(source, "kills", 0) --set "kills" to 0 end) addEventHandler("onPlayerWasted", getRootElement(), function (ammo, killer, weapon, body, stealth) if (killer) then --if there is a killer addScoreKill(killer) --if someone kills somebody add a kill end end) 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