Jump to content

setElementDimension And setElementPosition With playSound3D


micheal1230

Recommended Posts

Posted
theSound = playSound3D ( args... ) 
setElementDimension ( theSound, 1 ) 
setElementPosition ( theSound, 0, 0, 5 ) 

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

Why dont this work?

  
VCM = playSound3D("vcm.mp3", 837.90606689453, -2066.2963867188, 16.712882995605,true) 
function OpenLogin() 
    local width, height = guiGetScreenSize() 
    local x,y,z = getElementPosition( getLocalPlayer ( ) ) 
    local dim = getElementDimension( getLocalPlayer ( ) ) 
     
    setElementDimension ( VCM, dim ) 
    setElementPosition ( VCM, x,y,z ) 
    setSoundVolume(VCM, 1) 

Posted

Why don't you just create the sound instead of setting the position?

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

Why do you need to make it 3D anyway? It looks like a login script, so I guess, when you're logging in you don't move around. Why set its dimensions? It'll be played only for the person who logs in unless you trigger the event for everyone which would be pointless.

Posted
Why do you need to make it 3D anyway? It looks like a login script, so I guess, when you're logging in you don't move around. Why set its dimensions? It'll be played only for the person who logs in unless you trigger the event for everyone which would be pointless.

Yeah i want it to play for people that are on the log in screen

Edit: My beats are playing now :-D

Posted

it's so simple

server

addEventHandler("onPlayerJoin",root, 
    function() 
        triggerClientEvent(source,"newPlayer",source) 
    end 
) 

client

addEvent("newPlayer",true) 
addEventHandler("newPlayer",localPlayer, 
    function() 
        playSound("vcm.mp3") 
    end 
) 

just try that

F4MZM4.gif

Posted
it's so simple

server

addEventHandler("onPlayerJoin",root, 
    function() 
        triggerClientEvent(source,"newPlayer",source) 
    end 
) 

client

addEvent("newPlayer",true) 
addEventHandler("newPlayer",localPlayer, 
    function() 
        playSound("vcm.mp3") 
    end 
) 

just try that

Edit: My beats are playing now

Posted
it's so simple

server

addEventHandler("onPlayerJoin",root, 
    function() 
        triggerClientEvent(source,"newPlayer",source) 
    end 
) 

client

addEvent("newPlayer",true) 
addEventHandler("newPlayer",localPlayer, 
    function() 
        playSound("vcm.mp3") 
    end 
) 

just try that

Edit: My beats are playing now

It will play only if you have the resource downloaded and you join the server. Server will try to trigger client-side event even before the file is downloaded so the first time you join the server it will not play but the next time if the resource will not be changed then you will hear the sound.

Posted
it's so simple

server

addEventHandler("onPlayerJoin",root, 
    function() 
        triggerClientEvent(source,"newPlayer",source) 
    end 
) 

client

addEvent("newPlayer",true) 
addEventHandler("newPlayer",localPlayer, 
    function() 
        playSound("vcm.mp3") 
    end 
) 

just try that

Edit: My beats are playing now

It will play only if you have the resource downloaded and you join the server. Server will try to trigger client-side event even before the file is downloaded so the first time you join the server it will not play but the next time if the resource will not be changed then you will hear the sound.

Nope tested it and it works

Posted

@micheal1230, go to your client folder and find the client resources that you download from servers then delete the resource that plays the sound (so that you're like visiting your server for the first time) and see if it plays, if it does then you download the script quicker then server triggered the onPlayerJoin event which won't happen too often to other players if at all.

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