Jump to content

DXSCOREBOARD HELP PLEASE


Recommended Posts

So for example if you have FPS resource which saves element data with string: "FPS" you will do this...

addEventHandler ( "onClientResourceStart", resourceRoot,  
    function ( ) 
        exports.scoreboard:scoreboardAddColumn ( "FPS" ) 
        setElementData ( getLocalPlayer ( ), "FPS", 0 ) 
    end 
) 
  
-- please note that for to add column you must add it's name 
-- as same as the name when you set player's element data 

Edited by Guest
Link to comment

and that if i'm right, it will add a column every time a resource is started.

addEventHandler ( "onClientResourceStart", getRootElement(), 
function (resource) 
if resource == getThisResource() then 
        exports.scoreboard:scoreboardAddColumn ( "FPS" ) 
        setElementData ( getLocalPlayer ( ), "FPS", 0 ) 
         end 
    end 
) 

Link to comment
  • Moderators

You have to create an element data like this:

(Use the code of Solidsnake and add your element data:)

addEventHandler ( "onClientResourceStart", getRootElement(), 
function (resource) 
if resource == getThisResource() then 
        exports.scoreboard:scoreboardAddColumn ( "FPS" ) 
        exports.scoreboard:scoreboardAddColumn ( "State" ) 
        setElementData ( getLocalPlayer ( ), "FPS", 0 ) 
        setElementData(  getLocalPlayer ( ), "State", "Waiting" ) 
        end 
    end 
) 

Add change his state whenever you want like this:

setElementData( thePlayer, "State", "Alive" ) 

set it to "Alive" or "Waiting" or "Dead"

Exemple:

function onPlayerDead( ammo, attacker, weapon, bodypart ) 
    setElementData( source, "State", "Dead" ) 
end 
addEventHandler( "onClientPlayerWasted", getRootElement(), onPlayerDead ) 

Link to comment
  • Moderators
im not sure if u understiid my point i just want that it shows whetever player is alive waiting or dead in the dxscoreboard

Yeah I understoud it :roll:

The dxScoreboard make a getElementData each seconds ( maybe or 2 sec IDK ) so you just have to specify to your scoreboard the ElementData by this line:

 exports.scoreboard:scoreboardAddColumn( "theElementData" ) 

When the dxScoreboard knows the ElementData to get, you can:

setElementData( thePlayer, "ElementData", theValue ) 

when and wherever you want and the scoreboard update the column automatically.

That's right ? ( Maybe I'm wrong ? )

EDIT: I checked the dxscoreboard and I'm right

Link to comment
  • Moderators

----------------------------------

Double Post:

----------------------------------

For the column ping in your scoreboard try this:

add this with the others exports.scoreboard:scoreboardAddColumn:

 exports.scoreboard:scoreboardAddColumn( "PING" ) 

and put it anywhere:

function refreshPing() 
    local ping = getPlayerPing( getLocalPlayer() ) 
    setElementData( getLocalPlayer(), "PING", ping ) 
end 
setTimer( refreshPing, 2000, 0 ) 

and It might works

Link to comment
  • 1 month later...
and that if i'm right, it will add a column every time a resource is started.
addEventHandler ( "onClientResourceStart", getRootElement(), 
function (resource) 
if resource == getThisResource() then 
        exports.scoreboard:scoreboardAddColumn ( "FPS" ) 
        setElementData ( getLocalPlayer ( ), "FPS", 0 ) 
         end 
    end 
) 

Where i add this ?

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