jean001 Posted June 18, 2021 Posted June 18, 2021 I just make a script to input a HTML into MTA:SA and i found error say "SCRIPT ERROR: html-test\index.html:1: unexpected symbol near '<' " here my HTML code & lua script <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Test</title> </head> <body> <img src="https://www.kibrispdr.org/data/gta-v-wallpaper-27.jpg" width="1340px" height="670px"> </body> </html> local screenWidth, screenHeight = guiGetScreenSize() local page = "http://mta/local/index.html" local webBrowser = guiCreateBrowser(0, 0, screenWidth, screenHeight, true, true, false) local theBrowser = guiGetBrowser(webBrowser) addEventHandler("onClientBrowserCreated", theBrowser, function() loadBrowserURL(source, page) showCursor(true) end)
Skully Posted June 18, 2021 Posted June 18, 2021 Why are you trying to run a .html file through Lua? To do this correctly, you need to have two seperate files; one for the web page and your client side Lua code which loads the web page itself, from your error it looks like everything is in one file as you have displayed it? You cannot run HTML code and Lua within the same file.
jean001 Posted June 19, 2021 Author Posted June 19, 2021 Oh Sorry it's my mistake, i make two file there is index.html and client.lua the source code on the post should be have 2 like this index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Test</title> </head> <body> <img src="https://www.kibrispdr.org/data/gta-v-wallpaper-27.jpg" width="1340px" height="670px"> </body> </html> client.lua local screenWidth, screenHeight = guiGetScreenSize() local page = "http://mta/local/index.html" local webBrowser = guiCreateBrowser(0, 0, screenWidth, screenHeight, true, true, false) local theBrowser = guiGetBrowser(webBrowser) addEventHandler("onClientBrowserCreated", theBrowser, function() loadBrowserURL(source, page) showCursor(true) end)
Skully Posted June 20, 2021 Posted June 20, 2021 Can you show your meta.xml file and how you are importing these?
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