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.

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

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

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

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

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.

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

You're welcome.

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

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.

Software Engineer & Entrepreneur Running Lustrel and VilarikA • Highly engaged on open source community

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