Samking Posted September 21, 2018 Share 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 Link to comment
Moderators IIYAMA Posted September 21, 2018 Moderators Share 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. Link to comment
Samking Posted September 22, 2018 Author Share 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? Link to comment
iMr.WiFi..! Posted September 22, 2018 Share 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]". Link to comment
Moderators IIYAMA Posted September 22, 2018 Moderators Share 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 Link to comment
Samking Posted September 22, 2018 Author Share Posted September 22, 2018 2 hours ago, iMr.WiFi..! said: Show us code of button creation "GUIEditor.button[15]". Whole Client side? Link to comment
Samking Posted September 22, 2018 Author Share 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") Link to comment
Rockyz Posted September 22, 2018 Share 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 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