tim260 Posted May 4, 2012 Share Posted May 4, 2012 Hey guys, i have a table in my scoreboard for the spawned skin from 50p's spawn menu. exports["scoreboard"]:scoreboardAddColumn ( "Class", root, 80 ) setElementData ( client, "Class", skin.name ) How can i do like : if getElementData(source,"Class") == "Admin" because i cant get it to work Link to comment
Castillo Posted May 5, 2012 Share Posted May 5, 2012 I don't understand your question. Link to comment
Jaysds1 Posted May 5, 2012 Share Posted May 5, 2012 I don't understand your question. I think he means getting the element data from the scoreboard... @tim you can't get the element data from the table, the element data is on the player, so if you want to get the class from a certain player, use: getElementsByType("player") for i,v in ipairs(--[[the table from the getElementsByType]])do --code end Link to comment
tim260 Posted May 5, 2012 Author Share Posted May 5, 2012 I don't understand your question. I think he means getting the element data from the scoreboard... @tim you can't get the element data from the table, the element data is on the player, so if you want to get the class from a certain player, use: getElementsByType("player") for i,v in ipairs(--[[the table from the getElementsByType]])do --code end i dont understand it ;p Link to comment
X-SHADOW Posted May 5, 2012 Share Posted May 5, 2012 you want get the element data and set it by the class ? for an example if getElementData(source) == '1' then in scoreboard show like this tim260 [ Class 1] ? Link to comment
tim260 Posted May 6, 2012 Author Share Posted May 6, 2012 What im trying to do is f.e. this : function setAdmin ( thePlayer ) if getElementData(source,"Class") == "Admin" then setElementModel ( thePlayer, 217 ) end addCommandHandler ( "staff", setAdmin ) restrict commands on class do you guys understand it now ? And im using 50p's spawn menu ( with a edit from castillo ) Link to comment
Castillo Posted May 6, 2012 Share Posted May 6, 2012 function setAdmin ( thePlayer ) if ( getElementData ( thePlayer, "Class" ) == "Admin" ) then -- Your player element is "thePlayer" not "source". setElementModel ( thePlayer, 217 ) end -- Missing end. end addCommandHandler ( "staff", setAdmin ) Read comments. Link to comment
tim260 Posted May 6, 2012 Author Share Posted May 6, 2012 nvm, thanks castillo it worked ! Link to comment
Stanley Sathler Posted May 7, 2012 Share Posted May 7, 2012 And Tim260... I'm not a moderator, but remember bro: use titles well explained. Avoid titles like "Someone can help me", "My script doesn't work" and something like it. If you use objective titles, we will be more interested on click on your topic. Good luck with your codes. Stanley Sathler. 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