Jump to content

setElementDimension And setElementPosition With playSound3D


micheal1230

Recommended Posts

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) 

Link to comment

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.

Link to comment
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

Link to comment

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

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment

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

Link to comment

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