Andrew75t Posted August 9, 2020 Share Posted August 9, 2020 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
SpecT Posted August 10, 2020 Share Posted August 10, 2020 (edited) 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 August 10, 2020 by SpecT 1 Link to comment
Andrew75t Posted August 10, 2020 Author Share Posted August 10, 2020 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 IIYAMA Posted August 10, 2020 Moderators Share Posted August 10, 2020 (edited) 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 August 10, 2020 by IIYAMA 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now