Jump to content

How do i do this ?


Recommended Posts

Posted

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

Posted
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 

Posted
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

Posted

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] ?

Posted

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 )

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

Posted

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.

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