manve1 Posted January 2, 2013 Share Posted January 2, 2013 How can i add text to a column of a scoreboard? Edit: I am using it via client side Link to comment
Castillo Posted January 2, 2013 Share Posted January 2, 2013 You mean change a data which is shown in the scoreboard? example: "kills". Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 Yeh. Something like that, but without numbers just with text (( p.s. the text is: 'yes' or 'no' )) Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 how could i use it ? i never tried making stuff with scoreboard, and i need help with the setting column information Link to comment
Castillo Posted January 2, 2013 Share Posted January 2, 2013 setElementData ( localPlayer, "YourDataNameHere", "Hello World!" ) Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 will this work for the mta original scoreboard? Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 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. Link to comment
Castillo Posted January 2, 2013 Share Posted January 2, 2013 How could I know? I'm not a guesser, I don't know how your script looks/works like. Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 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 Link to comment
Castillo Posted January 2, 2013 Share Posted January 2, 2013 You don't need to do that, you can use it with the exported function, also, your data name is "med_kit". Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 how do i do it now, because i'm not sure what to use right now Link to comment
Castillo Posted January 2, 2013 Share Posted January 2, 2013 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 ) Link to comment
manve1 Posted January 2, 2013 Author Share Posted January 2, 2013 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. 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