Samking Posted September 21, 2018 Posted September 21, 2018 function fly() if isPedInVehicle(localPlayer) == false then outputChatBox("You can only use FLY car mode when in Vehicle", 255, 0, 0, true) end if isPedInVehicle(localPlayer) == true then if source == GUIEditor.button[15] then setWorldSpecialPropertyEnabled("aircars", true) outputChatBox("Fly Mode is Disabled ", 255,215,0, true) end end end addEventHandler("onClientGUIClick", GUIEditor.button[15], fly, false) Bad Argument @AddEventHsndler Except Element Argument 2 got nil plz fix
Moderators IIYAMA Posted September 21, 2018 Moderators Posted September 21, 2018 addEventHandler("onClientGUIClick", GUIEditor.button[15], fly, false) The table reference inside of the variable GUIEditor.button[15] doesn't contain the reference of a button[element]. With other words, the there is no button (yet) created when the line 12 is executed. This might solve the problem, if the issue is caused by a wrong code execution order: addEventHandler("onClientResourceStart", resourceRoot, function () addEventHandler("onClientGUIClick", GUIEditor.button[15], fly, false) end, true, "low") If the button doesn't exist, this code will not solve your problem. Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Samking Posted September 22, 2018 Author Posted September 22, 2018 12 hours ago, IIYAMA said: addEventHandler("onClientGUIClick", GUIEditor.button[15], fly, false) The table reference inside of the variable GUIEditor.button[15] doesn't contain the reference of a button[element]. With other words, the there is no button (yet) created when the line 12 is executed. This might solve the problem, if the issue is caused by a wrong code execution order: addEventHandler("onClientResourceStart", resourceRoot, function () addEventHandler("onClientGUIClick", GUIEditor.button[15], fly, false) end, true, "low") If the button doesn't exist, this code will not solve your problem. It's not Working Plz can u make one for me?
iMr.WiFi..! Posted September 22, 2018 Posted September 22, 2018 1 hour ago, Samking said: It's not Working Plz can u make one for me? Show us code of button creation "GUIEditor.button[15]". Experienced MTA developer for 4 years. | MTA خبرة 4 سنين في برمجة ليس عليك اسعاد الجميع , ولكن عليك بإن لا تؤذي أحداً =========You do not have to make everyone happy, But you should not hurt anyone Want to contact with me? Discord: JustCarry#2616 (Always there)Skype: Live:JustCarry10 (Not always)
Moderators IIYAMA Posted September 22, 2018 Moderators Posted September 22, 2018 2 hours ago, Samking said: It's not Working Plz can u make one for me? My purpose here is teaching and not free scripting. Please help yourself: https://wiki.multitheftauto.com/wiki/GuiCreateButton https://wiki.multitheftauto.com/wiki/AddEventHandler 1 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Samking Posted September 22, 2018 Author Posted September 22, 2018 2 hours ago, iMr.WiFi..! said: Show us code of button creation "GUIEditor.button[15]". Whole Client side?
Samking Posted September 22, 2018 Author Posted September 22, 2018 3 hours ago, iMr.WiFi..! said: Show us code of button creation "GUIEditor.button[15]". GUIEditor.button[15] = guiCreateButton(203, 273, 128, 59, "Fly car", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[15], "default-bold-small") guiSetProperty(GUIEditor.button[15], "NormalTextColour", "FF0C6DF2")
Rockyz Posted September 22, 2018 Posted September 22, 2018 1 hour ago, Samking said: GUIEditor.button[15] = guiCreateButton(203, 273, 128, 59, "Fly car", false, GUIEditor.window[1]) guiSetFont(GUIEditor.button[15], "default-bold-small") guiSetProperty(GUIEditor.button[15], "NormalTextColour", "FF0C6DF2") Put your codes under the creation of the button
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