GodOfPenguins Posted July 12, 2017 Share Posted July 12, 2017 I'm not sure I could explain this in English, because It was not just in my native Russian. But im try and hope someone understand and help me with this bug. Problem with the auth/reg resource (only when it is started) which I can not understand and solve. When it resource is started, it and other resources started in multiple copies, as a result of which all actions are performed many times (creating GUI, output text in chat, etc.deleting elements works with only one instance). resource has nothing to do with the others. Has no functions to start / restart resources, only uses the exported function connection to mysql database and dgs (The problem was before using dgs). I absolutely can not understand why this is happening. The same happens when other resources are started, if the authorization resource is started. Those. If I start or restart the resource using the console, new copies of other resources are started. if for example I restart another resource three times then three new copies of other resources will be launched and three authorization windows will be created. But if I restart the authorization resource, then after creating only one window rather than a 5, as in the first run, but when I authorize, many messages output in chat, and not one. In the debug, there are no errors related to this. Link to comment
Simple0x47 Posted July 12, 2017 Share Posted July 12, 2017 I think I get why the bug is provoked. You added a handler to the "onResourceStart" event and the "onClientResourceStart" one. Search for them and be sure they are like this: addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), theOriginalFunction ) -- Replace 'theOriginalFunction' with your own function name addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), theOriginalFunction ) -- Replace 'theOriginalFunction' with your own function name -- Look for 'onResourceStart' in server side scripts and for 'onClientResourceStart' in client side scripts. 1 Link to comment
GodOfPenguins Posted July 12, 2017 Author Share Posted July 12, 2017 5 minutes ago, Uknown. said: I think I get why the bug is provoked. You added a handler to the "onResourceStart" event and the "onClientResourceStart" one. Search for them and be sure they are like this: addEventHandler( "onResourceStart", getResourceRootElement( getThisResource() ), theOriginalFunction ) -- Replace 'theOriginalFunction' with your own function name addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), theOriginalFunction ) -- Replace 'theOriginalFunction' with your own function name -- Look for 'onResourceStart' in server side scripts and for 'onClientResourceStart' in client side scripts. Only for create GUI: addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() fadeCamera(true) setCameraMatrix(150, 0, 250) showCursor(true) authGUI.loginWindow = exports.dgs:dgsDxCreateWindow(0.74, 0.33, 0.25, 0.35, "Авторизация", true, 0xFFFFFFFF, 25, nil, 0xC8141414, nil, 0x96141414, 5, true) exports.dgs:dgsDxWindowSetMovable(authGUI.loginWindow, false) exports.dgs:dgsDxWindowSetSizable(authGUI.loginWindow, false) --guiSetAlpha(authGUI.loginWindow, 0.80) authGUI.edit[1] = exports.dgs:dgsDxCreateEdit(0.04, 0.13, 0.93, 0.09, "Имя_Фамилия", true, authGUI.loginWindow) --exports.dgs:dgsDxEditSetMaxLength(authGUI.edit[1], 32) authGUI.edit[2] = exports.dgs:dgsDxCreateEdit(0.04, 0.26, 0.93, 0.08, "Пароль", true, authGUI.loginWindow) --exports.dgs:dgsDxEditSetMaxLength(authGUI.edit[2], 32) authGUI.button[1] = exports.dgs:dgsDxCreateButton(0.26, 0.41, 0.47, 0.18, "Войти", true, authGUI.loginWindow) --exports.dgs:dgsDxGUISetFont(authGUI.button[1], "default-bold-small") authGUI.button[2] = exports.dgs:dgsDxCreateButton(0.26, 0.74, 0.47, 0.18, "Создать аккаунт", true, authGUI.loginWindow) --exports.dgs:dgsDxGUISetFont(authGUI.button[2], "default-bold-small") addEventHandler("onClientDgsDxMouseClick", getRootElement(), function() if source == authGUI.edit[1] then exports.dgs:dgsDxGUISetText(authGUI.edit[1], "") elseif source == authGUI.edit[2] then exports.dgs:dgsDxGUISetText(authGUI.edit[2], "") --guiEditSetMasked(authGUI.edit[2], true) elseif source == authGUI.button[1] then local name, pass = exports.dgs:dgsDxGUIGetText(authGUI.edit[1]), exports.dgs:dgsDxGUIGetText(authGUI.edit[2]) if (name == "") or (pass == "") then outputChatBox("Не заполнены данные для входа!") else triggerServerEvent("PlayerLogin", getLocalPlayer(), name, pass) end elseif source == authGUI.button[2] then destroyElement(authGUI.loginWindow) authGUI.staticimage[1] = exports.dgs:dgsDxCreateImage(0.55, 0.22, 0.45, 0.71, "img/zayva.png", true) authGUI.edit[3] = exports.dgs:dgsDxCreateEdit(0.12, 0.29, 0.24, 0.03, "", true, authGUI.staticimage[1]) exports.dgs:dgsDxGUISetFont(authGUI.edit[3], "avalon") authGUI.edit[4] = exports.dgs:dgsDxCreateEdit(0.18, 0.54, 0.25, 0.02, "", true, authGUI.staticimage[1]) authGUI.radiobutton[1] = exports.dgs:dgsDxCreateRadioButton(0.19, 0.63, 0.03, 0.02, "", true, authGUI.staticimage[1]) exports.dgs:dgsDxRadioButtonSetSelected(authGUI.radiobutton[1], true) authGUI.radiobutton[2] = exports.dgs:dgsDxCreateRadioButton(0.32, 0.63, 0.03, 0.02, "", true, authGUI.staticimage[1]) authGUI.button[3] = exports.dgs:dgxDxCreateButton(0.15, 0.74, 0.30, 0.15, "Подписать", true, authGUI.staticimage[1]) --guiSetFont(authGUI.button[3], "default-bold-small") addEventHandler("onClientDgsDxMouseClick", getRootElement(), function() if source == authGUI.button[3] then local name, pass, serial = exports.dgs:dgsDxGUIGetText(authGUI.edit[3]), exports.dgs:dgsDxGUIGetText(authGUI.edit[4]), getPlayerSerial() if (exports.dgs:dgsDxRadioButtonGetSelected(authGUI.radiobutton[1])) then sex = 1 outputDebugString(sex) elseif (exports.dgs:dgsDxRadioButtonGetSelected(authGUI.radiobutton[2])) then sex = 2 outputDebugString(sex) end if (name == "") or (pass == "") or (sex == nil) then outputChatBox("Не все поля заполнены!") else triggerServerEvent("PlayerRegistration", getLocalPlayer(), name, pass, serial, sex) end end end ) end end ) end ) Link to comment
Simple0x47 Posted July 12, 2017 Share Posted July 12, 2017 It keeps opening more than one? Link to comment
GodOfPenguins Posted July 12, 2017 Author Share Posted July 12, 2017 (edited) 21 minutes ago, Uknown. said: It keeps opening more than one? Aldeady no. Thanks for the help. Before that I used getRootElement(), but now I understood the difference Edited July 12, 2017 by Taka Link to comment
pa3ck Posted July 12, 2017 Share Posted July 12, 2017 BTW.: if you think you're unable to explain certain things in English, you can also just use the Russian section here: https://forum.multitheftauto.com/forum/100-russian-русский/ 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