Jump to content

check this code


Samking

Recommended Posts

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

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
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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...