KingBC

Wind sound in Login Panel

Recommended Posts

Guys, I have a problem with my login panel.
I set to play a song but the wind is still in the background.

Help me

Share this post


Link to post

Hey, do you got a problem if you set the sound to 0 that mean he will not hear anything until he login into a account? If you don't got problem you can:

function SoundOnLogin ( guest )
    Guest = getPlayerAccount ( guest )
    if isGuestAccount ( Guest ) then
        setSoundVolume(sound, 0)
    elseif ( not isGuestAccount ( Guest ) ) then
        setSoundVolume(sound, 1)
    end 
end
addEventHandler("onResourceStart", localPlayer, SoundOnLogin ) 

That should fix it, I just removed the sound to the time the player login to his account the sound will back to normal. 

Share this post


Link to post
22 minutes ago, SSKE said:

Hey, do you got a problem if you set the sound to 0 that mean he will not hear anything until he login into a account? If you don't got problem you can:


function SoundOnLogin ( guest )
    Guest = getPlayerAccount ( guest )
    if isGuestAccount ( Guest ) then
        setSoundVolume(sound, 0)
    elseif ( not isGuestAccount ( Guest ) ) then
        setSoundVolume(sound, 1)
    end 
end
addEventHandler("onResourceStart", localPlayer, SoundOnLogin ) 

That should fix it, I just removed the sound to the time the player login to his account the sound will back to normal. 

I pasted into client.lua but it did not work, it continues the same thing: /

Share this post


Link to post

did you try Server? I mean did you try it on the both of Server and Client Type?
 

Edited by SSKE

Share this post


Link to post
3 minutes ago, SSKE said:

did you try Server? I mean did you try it on the both of Server and Client Type?
 

Same problem

Share this post


Link to post
1 hour ago, SSKE said:

Hey, do you got a problem if you set the sound to 0 that mean he will not hear anything until he login into a account? If you don't got problem you can:


function SoundOnLogin ( guest )
    Guest = getPlayerAccount ( guest )
    if isGuestAccount ( Guest ) then
        setSoundVolume(sound, 0)
    elseif ( not isGuestAccount ( Guest ) ) then
        setSoundVolume(sound, 1)
    end 
end
addEventHandler("onResourceStart", localPlayer, SoundOnLogin ) 

That should fix it, I just removed the sound to the time the player login to his account the sound will back to normal. 

Sorry my fault, know I remember that you should specify the sound you want to set his volume.. all what i could find is: 

 

Quote

 

This example disables the wind sound effect immediately without changing the interior afterwards.


setWorldSoundEnabled(0, 0, false, true)
setWorldSoundEnabled(0, 29, false, true)
setWorldSoundEnabled(0, 30, false, true)

 


 

Share this post


Link to post

@KingBC

Try this out.

Server Side :-

addEventHandler("onPlayerJoin", getRootElement(),
function ()
    fadeCamera(source,false)
end
) 

addEventHandler("onPlayerLogin", root,
function ()
    fadeCamera(source,true)
end
)

When player join to the server, that player's camera will fade out. When he logged in, camera come back to normal. According to the "fadeCamera" theory... 50% faded = 50% volume, full fade = no sound.

Share this post


Link to post

Well i was searching on https://wiki.multitheftauto.com and i found that
 Note: This function does not affect sounds which are already playing, such as the wind sound that can only be stopped by entering an interior.
so i was thinking if he spawn in a interior another of 0 it will remove the wind sound then on Login the player will spawn in a random place of spawnpoints with random skin 
Tested and Worked~ 

function OnPlayerJoins ()
    spawnPlayer ( source, 0, 0, 5, 0, math.random (0,288), 1, 0, Guest)
end
addEventHandler("onPlayerJoin", getRootElement(), OnPlayerJoins)

local spawnpoints =
{
    {1607, 1857, 11},
    {2507, -1668, 13},
    {1557, -1675, 16},
    {1572, -1633, 13},
}
local validSkins = {0, 1, 2, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 66, 67, 68, 69, 70, 71, 72, 73, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312}
addEventHandler("onPlayerLogin", root,
    function ()
        if source and isElement( source ) then
            local x,y,z,r = unpack(spawnpoints[math.random(1,#spawnpoints)])
            spawnPlayer( source, x+math.random(-3,3), y+math.random(-3,3), z, r, validSkins[math.random(1,#validSkins)], 0, 0)
            fadeCamera( source, true)
            setCameraTarget( source, source)
            showChat( source, true)
        end
    end
)

Add it on Server Side ~ 

Edited by SSKE

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.