Jump to content

Question - Scoreboard columns


manve1

Recommended Posts

Posted

You mean change a data which is shown in the scoreboard? example: "kills".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Use:

setElementData 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
setElementData ( localPlayer, "YourDataNameHere", "Hello World!" ) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Yes, it should.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
Yes, it should.

Could you please tell me in which script i put this in:

setElementData( localPlayer, 'Medic Kit', 'No' ) 

P.S. I am editing the original file.

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted

How could I know? I'm not a guesser, I don't know how your script looks/works like.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

The script is as i told u, the original MTA scoreboard just wit ha new column named 'Medic Kit'. there are more column's, but this is how the script looks from 'dxscoreboard_exports.lua'

function scoreboardResetColumns( forElement, thePlayer ) 
    forElement = iif( type( forElement ) == "userdata" and isElement( forElement ), forElement, getRootElement() ) 
     
    if forElement == getRootElement() then 
        while ( scoreboardColumns[1] ) do 
            table.remove( scoreboardColumns, 1 ) 
            resourceColumns = {} 
        end 
        local result = triggerClientEvent( getRootElement(), "doScoreboardResetColumns", getRootElement() ) 
        if result then 
            scoreboardAddColumn( "name", 200, "Nickname" ) 
            scoreboardAddColumn( "med_kit", 100, "Medic kit" ) 
            setElementData( thePlayer, 'Medic Kit', 'No' ) 
        end 
        return result 
    else 
        return triggerClientEvent( forElement, "doScoreboardResetColumns", getRootElement(), false ) 
    end 
end 

I know this is wrong (( because it didn't work )), but it doesn't have any errors.

NOTE: This is only a small piece

Looking for tutorials or information? check out: www.simpleask.co.uk

Posted

You don't need to do that, you can use it with the exported function, also, your data name is "med_kit".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Create a new resource and a server side script:

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        exports [ "scoreboard" ]:scoreboardAddColumn ( "med_kit", 100, "Medic kit" ) 
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            setElementData ( thePlayer, 'med_kit', 'No' ) 
        end 
    end 
) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I found a few bugs, don't know why, but the column name was set to 'med_kit', i done minor changes and fixed it:

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        exports [ "scoreboard" ]:scoreboardAddColumn ( "Medic Kit", 100, "med_kit" ) 
        for _, thePlayer in ipairs ( getElementsByType ( "player" ) ) do 
            setElementData ( thePlayer, 'Medic Kit', 'No' ) 
        end 
    end 
) 

thanx for helping.

Looking for tutorials or information? check out: www.simpleask.co.uk

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