Zuher Laith Posted January 18, 2016 Posted January 18, 2016 Hello Everyone Few days ago i was creating a new design in "guieditor", I Didn't used the MTA Default Window, I Used an Image (Window Style) So The Problem Is, When I Bindkey, I Get Nothing Showing Up! Here's my Code: local Key = "F10" BindKeyFunc = function () guiSetVisible(Project.Background ,not guiGetVisible(Project.Background)); showCursor(guiGetVisible(Project.Background)); end bindKey(Key,"down",BindKeyFunc); -- Here is the ID's: Project.Background = guiCreateStaticImage((screenW - 357) / 2, (screenH - 304) / 2, 357, 304, "img.png", false) Project.WindowTittle = guiCreateLabel(87, 0, 183, 20, "Main", false, Project.Background) Here is The Meta: <file src="img.png" /> am I Missing Something Here ?.. Waiting for Reply.
Revolt Posted January 18, 2016 Posted January 18, 2016 (edited) Project = {} Did you declare a table? Edited January 18, 2016 by Guest
Zuher Laith Posted January 18, 2016 Author Posted January 18, 2016 Project = {} Do you declare a table? Might be like this? Project = {} GUIEditor = { gridlist = {}, staticimage = {}, label = {} } This is what the "guieditor" output for me .
Revolt Posted January 18, 2016 Posted January 18, 2016 You don't need the GUIEditor table if you're not using it. You'll be fine with just the Project table. Just make sure you declared it before any of it's content.
Zuher Laith Posted January 18, 2016 Author Posted January 18, 2016 You don't need the GUIEditor table if you're not using it. You'll be fine with just the Project table. Just make sure you declared it before any of it's content. We are done of this now .. What about the Bindkey ?
Tails Posted January 18, 2016 Posted January 18, 2016 What else do you have in your meta? Make sure the actual script file is in there as well.
Zuher Laith Posted January 18, 2016 Author Posted January 18, 2016 (edited) I told you that i'am using an image , So i need to hide/show image ! not a MTA Window ! Problem is in "BindkeyFunc" Edited January 18, 2016 by Guest
Zuher Laith Posted January 18, 2016 Author Posted January 18, 2016 What else do you have in your meta? Make sure the actual script file is in there as well. My META Is Fine, Also the MOD Works fine .. The Only Problem with BindkeyFunc it's not showing up the image "Project.Background"
WhoAmI Posted January 18, 2016 Posted January 18, 2016 Any errors in /debugscript 3? And as Tails said, make sure you've declared Project table. Project = {}
Zuher Laith Posted January 18, 2016 Author Posted January 18, 2016 Any errors in /debugscript 3?And as Tails said, make sure you've declared Project table. Project = {} The Script Doesn't Giving any Errors .. It Works Like Charm ! The Only Problem With "BindkeyFunc" (Check First Post for Code)
WhoAmI Posted January 18, 2016 Posted January 18, 2016 Yea, but what's the problem? The BindkeyFunc looks correctly, I don't see any errors in it. Insert outputChatBox function in it and check if it's running, like that local Key = "F10" BindKeyFunc = function () outputChatBox("test"); guiSetVisible(Project.Background ,not guiGetVisible(Project.Background)); showCursor(guiGetVisible(Project.Background)); end bindKey(Key,"down",BindKeyFunc); And check if 'test' message shows up on chat.
Zuher Laith Posted January 18, 2016 Author Posted January 18, 2016 Yea, but what's the problem? The BindkeyFunc looks correctly, I don't see any errors in it. Insert outputChatBox function in it and check if it's running, like that local Key = "F10" BindKeyFunc = function () outputChatBox("test"); guiSetVisible(Project.Background ,not guiGetVisible(Project.Background)); showCursor(guiGetVisible(Project.Background)); end bindKey(Key,"down",BindKeyFunc); And check if 'test' message shows up on chat. Problem Sloved. My Bad because i forgot to Change "Project.Background" to my Mod Name .. That's make me stupid actually Thank's Everyone for help!
Zuher Laith Posted January 21, 2016 Author Posted January 21, 2016 Hi Again .. I had the same problem , but with another mod So The Image Doesn't hide .. here is the code: local screenWidthh, screenHeightt = guiGetScreenSize() local windowWidthh, windowHeightt = 120, 201 local leftt = screenWidthh/3.5 - windowWidthh/3.5 local topp = screenHeightt/1 - windowHeightt/1 mywind[13] = guiCreateStaticImage(leftt,topp, windowWidthh,windowHeightt,"img/s1.png",false) guiSetAlpha(mywind[13],0.89999997615814) mywind[5] = guiCreateGridList(10, 10, 100, 113, false, mywind[13]) guiGridListSetSelectionMode(mywind[5],2) local column = guiGridListAddColumn(mywind[5], "Players", 0.60) row1 = guiGridListAddRow(mywind[5]) row2 = guiGridListAddRow(mywind[5]) row3 = guiGridListAddRow(mywind[5]) row4 = guiGridListAddRow(mywind[5]) row5 = guiGridListAddRow(mywind[5]) row6 = guiGridListAddRow(mywind[5]) guiGridListSetItemText(mywind[5],row1,column,"1 min", false, false) guiGridListSetItemColor ( mywind[5], row1, column, 0, 0, 255 ) guiGridListSetItemText(mywind[5],row2,column,"2 min", false, false) guiGridListSetItemColor ( mywind[5], row2, column, 0, 0, 255 ) guiGridListSetItemText(mywind[5],row3,column,"3 min", false, false) guiGridListSetItemColor ( mywind[5], row3, column, 0, 0, 255 ) guiGridListSetItemText(mywind[5],row4,column,"4 min", false, false) guiGridListSetItemColor ( mywind[5], row4, column, 0, 0, 255 ) guiGridListSetItemText(mywind[5],row5,column,"5 min", false, false) guiGridListSetItemColor ( mywind[5], row5, column, 0, 0, 255 ) guiGridListSetItemText(mywind[5],row6,column,"1 hour", false, false) guiGridListSetItemColor ( mywind[5], row6, column, 0, 0, 255 ) mywind[6] = guiCreateButton(10, 165, 100, 26, "Cancel", false, mywind[13]) mywind[8] = guiCreateButton(10, 130, 100, 26, "Throw", false, mywind[13]) for k,v in ipairs(mywind) do guiSetVisible(v,false) end So the Point is , i don't have a problem with binding The Only Problem is when i start the mod , the Background "mywind[13]" be visible , but the children of "mywind[13]" are hidden , and when i bindkey , The Children of "mywind[13]" Show's up normally! So , might be not the right line ? waiting for reply ..
Blaawee Posted January 22, 2016 Posted January 22, 2016 Is that all the code? try to re-check the table and guiSetVisible things.
Zuher Laith Posted January 22, 2016 Author Posted January 22, 2016 Is that all the code? try to re-check the table and guiSetVisible things. ------------------- --Key For Open Panel ------------------- local key = "O" --------------------- --Key to Open Panel --------------------- open = false bindKey ( key, "down", function ( ) if open == false then add() for k,v in ipairs(mywind) do guiSetVisible(v,true) end showCursor(true) open = true else close() end end ) --------------------- --Close Panel --------------------- function close() for k,v in ipairs(mywind) do guiSetVisible(v,false) end showCursor(false) open = false setCameraTarget ( getLocalPlayer() ) end The Object if Window is "mywind[13]" ..
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