Jump to content

Small help


manve1

Recommended Posts

Posted

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

Posted

onResourceStop has no player argument.

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

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

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Posted

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.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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