manve1 Posted December 29, 2012 Posted December 29, 2012 I came up with a problem when i can't properly set the player's alpha. I don't know why but it just wouldn't set it to visible if he was invisible addEventHandler('onResourceStop', getRootElement( ), function( p ) if ( getElementAlpha( p ) == 0 ) then setElementAlpha( p, 255 ) end end ) Looking for tutorials or information? check out: www.simpleask.co.uk
Castillo Posted December 29, 2012 Posted December 29, 2012 onResourceStop has no player argument. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
TAPL Posted December 29, 2012 Posted December 29, 2012 Event onResourceStop doesn't have player parameter. You need to use this to get all players. getElementsByType
manve1 Posted December 29, 2012 Author Posted December 29, 2012 Don't know if script should look like this but: addEventHandler('onResourceStop', getRootElement( ), function( ) if getElementsByType('player') and ( getElementAlpha( source ) == 0 ) then setElementAlpha( source, 255 ) end end ) P.S. It's my first time i use getElementAlpha Looking for tutorials or information? check out: www.simpleask.co.uk
Castillo Posted December 29, 2012 Posted December 29, 2012 getElementsByType returns a table of elements, not a element. addEventHandler ( 'onResourceStop', resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementAlpha ( player ) == 0 ) then setElementAlpha ( player, 255 ) end end end ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
manve1 Posted December 29, 2012 Author Posted December 29, 2012 Thanx Looking for tutorials or information? check out: www.simpleask.co.uk
Castillo Posted December 29, 2012 Posted December 29, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Anderl Posted December 29, 2012 Posted December 29, 2012 getElementsByType returns a table of elements, not a element. ddEventHandler ( 'onResourceStop', resourceRoot, function ( ) for _, player in ipairs ( getElementsByType ( "player" ) ) do if ( getElementAlpha ( player ) == 0 ) then setElementAlpha ( player, 255 ) end end end ) You forgot an "a" in "addEventHandler". "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
Castillo Posted December 30, 2012 Posted December 30, 2012 Yeah, when I put the lua tags I left it outside, then I though I had written it by mistake and removed it, added. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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