Minokon Posted May 3, 2011 Share Posted May 3, 2011 (edited) Hello I'm new in Lua and I need some help. I have a problem with that: -- meta.xml "Minokon" type="script" /> Script is added in mtaserver.conf And there isn't any reaction. Message "start" isn't outputed on the ChatBox. Can anyone help me with that? P.S Is there any support for polish symbols in GUI? Edited August 21, 2011 by Guest Link to comment
Kenix Posted May 3, 2011 Share Posted May 3, 2011 try this addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function( ) outputChatBox("start") -- create window local screenX, screenY = guiGetScreenSize() local sizeX, sizeY = 400, 300 fractionWindow = guiCreateWindow((screenX/2)-(sizeX/2), (screenY/2)-(sizeY/2), sizeX, sizeY, "Wybierz frakcje i skin", false) guiWindowSetMovable(fractionWindow, false) guiWindowSetSizable(fractionWindow, false) -- create label guiCreateLabel(5, 10, sizeX-50, 10, "Wybierz swoja frakcje, i swoj skin.", false, fractionWindow) -- create grid list fractionGridList = guiCreateGridList(10, 20, sizeX-85, sizeY-65, false, fractionWindow) guiGridListSetSelectionMode(fractionGridList, 0) guiGridListSetSortingEnabled(fractionGridList, false) -- adding rows for i = 1,19 do guiGridListAddRow(fractionGridList) end -- truckes section guiGridListSetItemText(fractionGridList, 0, 0, "Kierowcy", true, false) guiGridListSetItemText(fractionGridList, 1, 0, "ID 15", false, false) guiGridListSetItemText(fractionGridList, 2, 0, "ID 24", false, false) guiGridListSetItemText(fractionGridList, 3, 0, "ID 34", false, false) guiGridListSetItemText(fractionGridList, 4, 0, "ID 44", false, false) guiGridListSetItemText(fractionGridList, 5, 0, "ID 95", false, false) guiGridListSetItemText(fractionGridList, 6, 0, "ID 133", false, false) guiGridListSetItemText(fractionGridList, 7, 0, "ID 185", false, false) guiGridListSetItemText(fractionGridList, 8, 0, "ID 93", false, false) guiGridListSetItemText(fractionGridList, 9, 0, "ID 131", false, false) guiGridListSetItemText(fractionGridList, 10, 0, "ID 192", false, false) -- police section guiGridListSetItemText(fractionGridList, 11, 0, "Policjanci", true, false) guiGridListSetItemText(fractionGridList, 12, 0, "ID 280", false, false) guiGridListSetItemText(fractionGridList, 13, 0, "ID 281", false, false) guiGridListSetItemText(fractionGridList, 14, 0, "ID 282", false, false) guiGridListSetItemText(fractionGridList, 15, 0, "ID 283", false, false) guiGridListSetItemText(fractionGridList, 16, 0, "ID 284", false, false) guiGridListSetItemText(fractionGridList, 17, 0, "ID 285", false, false) guiGridListSetItemText(fractionGridList, 18, 0, "ID 288", false, false) -- auto size column guiGridListAutoSizeColumn(fractionGridList, 0) -- selected item guiGridListSetSelectedItem(fractionGridList, 0, 0) -- create image fractionImage = guiCreateStaticImage((sizeX-85)+20, 170/2, 55, 100, "images/Skin_15.png", false, fractionWindow) -- create button local bSizeX, bSizeY = 30, 15 fractionButton = guiCreateButton((sizeX/2)-(bSizeX/2), sizeY-15, bSizeX, bSizeY, "Wybierz", false, fractionWindow) -- other showCursor(true) guiSetInputEnabled(true) outputChatBox("end") end) your problem in 21 line i fix it and not use getRootElement() in onClientResourceStart or onResourceStart use getResourceRootElement(getThisResource()) otherwise at the start of any resource you will have to start this script. Link to comment
proracer Posted May 3, 2011 Share Posted May 3, 2011 HelloI'm new in Lua and I need some help. I have a problem with that: -- meta.xml "Minokon" type="script" /> Script is added in mtaserver.conf And there isn't any reaction. Message "start" isn't outputed on the ChatBox. Can anyone help me with that? P.S Is there any support for polish symbols in GUI? You added it in mtaserver.conf, what? You must create folder and put it in resources folder, in that created folder put your meta.xml and script files. Link to comment
Castillo Posted May 3, 2011 Share Posted May 3, 2011 Volk-rus, the line #21 is part of the meta.xml, what did you changed on it? Link to comment
proracer Posted May 3, 2011 Share Posted May 3, 2011 Author's: for 1,19 do Volk-rus's: for i = 1,19 do Link to comment
Castillo Posted May 3, 2011 Share Posted May 3, 2011 Ah, well, i suposed he changed something on the meta.xml part (original #21 line). Link to comment
Minokon Posted May 3, 2011 Author Share Posted May 3, 2011 (edited) Thank you volk-rus It's works. I have an problem with that argument when I have to insert element (rootElement or something). @proracer I'm newbie, but don't idiot Now I only have to configure positions of window elements ;p My version: function showFractionDialog() -- create window local screenX, screenY = guiGetScreenSize() local sizeX, sizeY = 400, 300 fractionWindow = guiCreateWindow((screenX/2)-(sizeX/2), (screenY/2)-(sizeY/2), sizeX, sizeY, "Wybierz frakcje i skin", false) guiWindowSetMovable(fractionWindow, false) guiWindowSetSizable(fractionWindow, false) -- create label guiCreateLabel(5, 10, sizeX-50, 10, "Wybierz swoja frakcje, i swoj skin.", false, fractionWindow) -- create grid list fractionGridList = guiCreateGridList(10, 20, sizeX-85, sizeY-65, false, fractionWindow) guiGridListSetSelectionMode(fractionGridList, 0) guiGridListSetSortingEnabled(fractionGridList, false) -- adding rows for i = 1,19 do guiGridListAddRow(fractionGridList) end -- truckes section guiGridListSetItemText(fractionGridList, 0, 0, "Kierowcy", true, false) guiGridListSetItemText(fractionGridList, 1, 0, "ID 15", false, false) guiGridListSetItemText(fractionGridList, 2, 0, "ID 24", false, false) guiGridListSetItemText(fractionGridList, 3, 0, "ID 34", false, false) guiGridListSetItemText(fractionGridList, 4, 0, "ID 44", false, false) guiGridListSetItemText(fractionGridList, 5, 0, "ID 95", false, false) guiGridListSetItemText(fractionGridList, 6, 0, "ID 133", false, false) guiGridListSetItemText(fractionGridList, 7, 0, "ID 185", false, false) guiGridListSetItemText(fractionGridList, 8, 0, "ID 93", false, false) guiGridListSetItemText(fractionGridList, 9, 0, "ID 131", false, false) guiGridListSetItemText(fractionGridList, 10, 0, "ID 192", false, false) -- police section guiGridListSetItemText(fractionGridList, 11, 0, "Policjanci", true, false) guiGridListSetItemText(fractionGridList, 12, 0, "ID 280", false, false) guiGridListSetItemText(fractionGridList, 13, 0, "ID 281", false, false) guiGridListSetItemText(fractionGridList, 14, 0, "ID 282", false, false) guiGridListSetItemText(fractionGridList, 15, 0, "ID 283", false, false) guiGridListSetItemText(fractionGridList, 16, 0, "ID 284", false, false) guiGridListSetItemText(fractionGridList, 17, 0, "ID 285", false, false) guiGridListSetItemText(fractionGridList, 18, 0, "ID 288", false, false) -- auto size column guiGridListAutoSizeColumn(fractionGridList, 0) -- selected item guiGridListSetSelectedItem(fractionGridList, 0, 0) -- create image fractionImage = guiCreateStaticImage((sizeX-85)+20, 170/2, 55, 100, "images/Skin_15.png", false, fractionWindow) -- create button local bSizeX, bSizeY = 30, 15 fractionButton = guiCreateButton((sizeX/2)-(bSizeX/2), sizeY-15, bSizeX, bSizeY, "Wybierz", false, fractionWindow) -- other showCursor(true) guiSetInputEnabled(true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), showFractionDialog) P.S I don't like creating function in addEventHandler, like you volk-rus. Regards, Minokon Edited August 21, 2011 by Guest Link to comment
Kenix Posted May 4, 2011 Share Posted May 4, 2011 Thank you volk-rus It's works.I have an problem with that argument when I have to insert element (rootElement or something). @proracer I'm newbie, but don't idiot Now I only have to configure positions of window elements ;p My version: function showFractionDialog() -- create window local screenX, screenY = guiGetScreenSize() local sizeX, sizeY = 400, 300 fractionWindow = guiCreateWindow((screenX/2)-(sizeX/2), (screenY/2)-(sizeY/2), sizeX, sizeY, "Wybierz frakcje i skin", false) guiWindowSetMovable(fractionWindow, false) guiWindowSetSizable(fractionWindow, false) -- create label guiCreateLabel(5, 10, sizeX-50, 10, "Wybierz swoja frakcje, i swoj skin.", false, fractionWindow) -- create grid list fractionGridList = guiCreateGridList(10, 20, sizeX-85, sizeY-65, false, fractionWindow) guiGridListSetSelectionMode(fractionGridList, 0) guiGridListSetSortingEnabled(fractionGridList, false) -- adding rows for i = 1,19 do guiGridListAddRow(fractionGridList) end -- truckes section guiGridListSetItemText(fractionGridList, 0, 0, "Kierowcy", true, false) guiGridListSetItemText(fractionGridList, 1, 0, "ID 15", false, false) guiGridListSetItemText(fractionGridList, 2, 0, "ID 24", false, false) guiGridListSetItemText(fractionGridList, 3, 0, "ID 34", false, false) guiGridListSetItemText(fractionGridList, 4, 0, "ID 44", false, false) guiGridListSetItemText(fractionGridList, 5, 0, "ID 95", false, false) guiGridListSetItemText(fractionGridList, 6, 0, "ID 133", false, false) guiGridListSetItemText(fractionGridList, 7, 0, "ID 185", false, false) guiGridListSetItemText(fractionGridList, 8, 0, "ID 93", false, false) guiGridListSetItemText(fractionGridList, 9, 0, "ID 131", false, false) guiGridListSetItemText(fractionGridList, 10, 0, "ID 192", false, false) -- police section guiGridListSetItemText(fractionGridList, 11, 0, "Policjanci", true, false) guiGridListSetItemText(fractionGridList, 12, 0, "ID 280", false, false) guiGridListSetItemText(fractionGridList, 13, 0, "ID 281", false, false) guiGridListSetItemText(fractionGridList, 14, 0, "ID 282", false, false) guiGridListSetItemText(fractionGridList, 15, 0, "ID 283", false, false) guiGridListSetItemText(fractionGridList, 16, 0, "ID 284", false, false) guiGridListSetItemText(fractionGridList, 17, 0, "ID 285", false, false) guiGridListSetItemText(fractionGridList, 18, 0, "ID 288", false, false) -- auto size column guiGridListAutoSizeColumn(fractionGridList, 0) -- selected item guiGridListSetSelectedItem(fractionGridList, 0, 0) -- create image fractionImage = guiCreateStaticImage((sizeX-85)+20, 170/2, 55, 100, "images/Skin_15.png", false, fractionWindow) -- create button local bSizeX, bSizeY = 30, 15 fractionButton = guiCreateButton((sizeX/2)-(bSizeX/2), sizeY-15, bSizeX, bSizeY, "Wybierz", false, fractionWindow) -- other showCursor(true) guiSetInputEnabled(true) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), showFractionDialog) P.S I don't like creating function in addEventHandler, like you volk-rus. Regards, Minokon No Problem. 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