Jump to content

Black screen after change coordinates (setCameraMatrix)


Andrew75t

Recommended Posts

Hello all. Please tell me, why I see only a black screen if I change coordinates in setCameraMatrix ? 

local window

addEvent('login-menu:open', true)
addEventHandler('login-menu:open', root, function ()
    -- fade their camera in
    setCameraMatrix (0, 0, 100, 0, 100, 50)
    fadeCamera(true)

    -- initialize the cursor
    showCursor(true, true)
    guiSetInputMode('no_binds')

    -- open our menu
    local x, y, width, height = getWindowPosition(400, 230)
    window = guiCreateWindow(x, y, width, height, 'Login to Our Server', false)
    guiWindowSetMovable(window, false)
    guiWindowSetSizable(window, false)

    local usernameLabel = guiCreateLabel(15, 30, width - 30, 20, 'Username:', false, window)

    local usernameErrorLabel = guiCreateLabel(width - 130, 30, 140, 20, 'Username is required', false, window)
    guiLabelSetColor(usernameErrorLabel, 255, 100, 100)
    guiSetVisible(usernameErrorLabel, false)

    local usernameInput = guiCreateEdit(10, 50, width - 20, 30, '', false, window)

    local passwordLabel = guiCreateLabel(15, 90, width - 30, 20, 'Password:', false, window)

    local passwordErrorLabel = guiCreateLabel(width - 125, 90, 140, 20, 'Password is required', false, window)
    guiLabelSetColor(passwordErrorLabel, 255, 100, 100)
    guiSetVisible(passwordErrorLabel, false)

    local passwordInput = guiCreateEdit(10, 110, width - 20, 30, '', false, window)
    guiEditSetMasked(passwordInput, true)

    local loginButton = guiCreateButton(10, 150, width - 20, 30, 'Login', false, window)
    addEventHandler('onClientGUIClick', loginButton, function (button, state)
        if button ~= 'left' or state ~= 'up' then
            return
        end

        local username = guiGetText(usernameInput)
        local password = guiGetText(passwordInput)
        local inputValid = true

        if not isUsernameValid(username) then
            guiSetVisible(usernameErrorLabel, true)
            inputValid = false
        else
            guiSetVisible(usernameErrorLabel, false)
        end

        if not isPasswordValid(password) then
            guiSetVisible(passwordErrorLabel, true)
            inputValid = false
        else
            guiSetVisible(passwordErrorLabel, false)
        end

        if not inputValid then
            return
        end

        triggerServerEvent('auth:login-attempt', localPlayer, username, password)
    end, false)

    local registerButton = guiCreateButton(10, 190, width / 2 - 15, 30, 'Sign Up', false, window)
    addEventHandler('onClientGUIClick', registerButton, function ()
        triggerEvent('login-menu:close', localPlayer)
        triggerEvent('register-menu:open', localPlayer)
    end, false)

    local forgotPasswordButton = guiCreateButton(width / 2 + 5, 190, width / 2 - 15, 30, 'Forgot Password', false, window)
    addEventHandler('onClientGUIClick', forgotPasswordButton, function ()
        outputChatBox('Coming soon.', 100, 100, 255)
    end, false)
end, true)

addEvent('login-menu:close', true)
addEventHandler('login-menu:close', root, function ()
    destroyElement(window)
    showCursor(false)
    guiSetInputMode('allow_binds')
end)

 

Link to comment

It's happening probably because the coordinates you put in there are inside building or under the ground.
Check out the wiki documentation about this function and how to use it on the client side: setCameraMatrix

PS: Oh I just noticed that the idea of all this is to make the screen black and show a login panel.
Isn't this what you want ?

Edited by SpecT
  • Thanks 1
Link to comment

SpecT, I did what was needed, everything works.  but i noticed when i log into the server for the first time after starting the server i see a black screen.  but if I go to the server without restarting the server itself, then everything works correctly, the camera is directed where the authorization system appears.  Therefore, when I indicated the coordinates I needed and saw a black screen, I thought that I had made a mistake somewhere.  I think mta does not have time to download everything and I see only a black screen.  what do you think it might be connected with?

Link to comment
  • Moderators
2 hours ago, Andrew75t said:

SpecT, I did what was needed, everything works.  but i noticed when i log into the server for the first time after starting the server i see a black screen.  but if I go to the server without restarting the server itself, then everything works correctly, the camera is directed where the authorization system appears.  Therefore, when I indicated the coordinates I needed and saw a black screen, I thought that I had made a mistake somewhere.  I think mta does not have time to download everything and I see only a black screen.  what do you think it might be connected with?

There are fade in/out states for the camera, maybe a script sets an invalid value, does not set the right one or none at all.

https://wiki.multitheftauto.com/wiki/FadeCamera

 

Edited by IIYAMA
  • Thanks 1
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...