Search the Community
Showing results for tags 'javascript'.
-
Hello guys, does anyone have an idea how to send Lua values to JavaScript to display them in the game, or for example, to show a list of players or run a JavaScript function?
-
بسم الله الرحمن الرحيم السلام عليكم ورحمة الله وبركاته قد بدأت في سلسلة شرح Javascript فإذا كنت مهتما، قم بزيارة قناتي على اليوتيوب من هنا وشكرا على مرورك
-
Hello guys I recently had ideas for setting up a server in MTA. I heard a bit about lua and its characteristics. I wanted to know what programming languages are needed to set up a game server in MTA and manage it from beginner to professional. thank you.?
-
Доброго времени суток. Возникла необходимость читать на JS файлы, располагающиеся в http://mta/... (как правило там же, где и сам index.html). Вариант с input type = file отпадает, так как отсутствует возможность инжектнуть туда путь (путь к файлам не должен передаваться пользователем вручную). Пробовал разные костыли, но все они не работают из соображений безопасности ( как например загнать в css селектор в свойство content содержимое файла ). Остается вариант скачивания через XMLHttpRequest (возможен наверно аналог через fetch ). Не ясно еще возможно ли скачивание с локалхоста на локалхост. (Вопрос еще в том насколько быстро оно работать будет. Если будет.) P.S: Вариант препроцессинга html страницы на луа ( впихивание содержимого файла в значение какого либо dom объекта ) отпадает сразу, тк. суть задачи читать файлы именно на JS и именно в CEF.
-
Hello I have an issue when I trigger an event that call a function using onClientBrowserDocumentReady, i don't know what is the issue... This is my code: The issue is... onClientBrowserDocumentReady doesn't found the browser and it can't in into the event. the executeBrowserJavascript doesn't work event = {add = addEventHandler, load = addEvent, execute = triggerServerEvent} local WINDOW_WIDTH, WINDOW_HEIGHT = guiGetScreenSize() local CEF = nil local browser = nil function deleteWebPage() if isElement(CEF) then destroyElement(CEF) showCursor(false) end end function createWebPage() page = "http://mta/player/html/login.html" CEF = guiCreateBrowser(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, true, false, false) browser = guiGetBrowser(CEF) addEventHandler("onClientBrowserCreated", browser, function() loadBrowserURL(source, page) showCursor(true) end) end function sendErrorLabel(error) addEventHandler("onClientBrowserDocumentReady", browser, function() executeBrowserJavascript(browser, "document.querySelector('.error:nth-child(5)').innerHTML = '" .. error .. "'"); executeBrowserJavascript(browser, "document.querySelector('.error:nth-child(5)').style = 'display: initial; top: 90%; left:40.5%'"); end) end event.load('login-data:send', true) event.add('login-data:send', root, function(user, password) event.execute('login-menu:execute', resourceRoot, user, password) end, true) event.load("onClientPlayerLogout", true) event.add("onClientPlayerLogout", root, function() createWebPage() end) event.load("show-label:error", true) event.add("show-label:error", root, function(error) sendErrorLabel(error) end) event.load('login-menu:remove', true) event.add('login-menu:remove', root, function() deleteWebPage() end) event.add("onClientResourceStart", resourceRoot, function() createWebPage() end)
- 1 reply
-
- executebrowserjavascript
- onclientbrowserdocumentready
- (and 3 more)
-
Hello everybody! I want to offer you a new language for writing scripts for MTA: SA. By the tags in the topic, you've already seen that it's Puthon 3. Many will say that Python 3 is bad for scripting, but it's not! It is similar to lua but has a wider OOP, and has the ability to connect modules. In the Internet very little material on lua, it is available but only in English, and what to do to the Russian community? The Russian segment in the MTA is very large, and lua materials are very small. Of course, the small amount of materials on the Internet for lua is not the reason for switching to Python 3. I understand that I will have to rewrite all functions from scratch, but this can prolong the life of the MTA. Python 3 is not one language that can be used as scripting under MTA: SA, there is also a wonderful language JavaScript v5. Many multiplayer use it as a language for writing scripts. This is just my opinion. I just suggested that the idea is not bad. Decide for you, dear multiplayer developers. Oh, sorry for my bad English!
-
I'm wanting to know if there is a way to execute javascript functions from MTA to an iframe that is being shown in the browser. When I try and execute the function, it says it isn't defined. Thanks.
-
Hi, Do WebSockets (for ex. libraries like Socket.IO) are working with browser created in MTA? I'm asking because I want to connect server via Socket.IO locally (NodeJS Express.js).
- 1 reply
-
- html
- javascript
-
(and 1 more)
Tagged with: