Jump to content

attempt to call global 'wnd_create'(a nil value)


Purdi

Recommended Posts

local screenX, screenY = guiGetScreenSize( )
local label = guiCreateLabel( 0, 0, screenX, 15, "Purdi "..exports.global:getScriptVersion().."", false )
guiSetSize( label, guiLabelGetTextExtent( label ) + 5, 14, false )
guiSetPosition( label, screenX - guiLabelGetTextExtent( label ) - 5, screenY - 27, false )
guiSetAlpha( label, 0.5 )

addEventHandler('onClientMouseEnter', label, function()
	guiSetAlpha(label, 1)
end, false)

addEventHandler('onClientMouseLeave', label, function()
	guiSetAlpha(label, 0.5)
end, false)


	addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ),  
	function ( theResource )

		if source == getResourceRootElement( theResource ) then
			local cmd = xmlLoadFile( "altele.xml" )
			local cmd1 = xmlNodeGetValue( cmd )
			local member = xmlLoadFile( "case.xml" )
			local member1 = xmlNodeGetValue( member )
			local other = xmlLoadFile( "masini.xml" )
			local other1 = xmlNodeGetValue( other )

		    wnd_create( cmd1, member1, other1 )
		end
end)
addEventHandler('onClientGUIClick', function() 
 function wnd_create(cmd, member, other)

GUIEditor_TabPanel = {}
GUIEditor_Tab = {}
GUIEditor_Memo = {}
GUIEditor_Image = {}


window = guiCreateWindow(136,130,544,346,"Changelog",false)
guiSetAlpha(window,1)
guiWindowSetSizable(window,false)
GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0404,0.2457,0.921,0.6936,true,window)
guiSetAlpha(GUIEditor_TabPanel[1],1)
tabcmd = guiCreateTab("ALTELE",GUIEditor_TabPanel[1])
guiSetAlpha(tabcmd,1)
GUIEditor_Memo[1] = guiCreateMemo(0.008,0.0231,0.984,0.9583,cmd,true,tabcmd)
guiSetAlpha(GUIEditor_Memo[1],1)
GUIEditor_Tab[1] = guiCreateTab("CASE",GUIEditor_TabPanel[1])
guiSetAlpha(GUIEditor_Tab[1],1)
GUIEditor_Memo[2] = guiCreateMemo(0.01,0.0324,0.98,0.9444,member,true,GUIEditor_Tab[1])
guiSetAlpha(GUIEditor_Memo[2],1)
GUIEditor_Tab[2] = guiCreateTab("MASINI",GUIEditor_TabPanel[1])
guiSetAlpha(GUIEditor_Tab[2],1)
GUIEditor_Memo[3] = guiCreateMemo(0.008,0.0185,0.982,0.963,other,true,GUIEditor_Tab[2])
guiSetAlpha(GUIEditor_Memo[3],1)
guiMemoSetReadOnly(GUIEditor_Memo[1],true)
guiMemoSetReadOnly(GUIEditor_Memo[2],true)
guiMemoSetReadOnly(GUIEditor_Memo[3],true)
end		
		end, true)

Hi guys, I created a label text and I want to create a window with 3 sections when I click on the label, but  I receive the error : attempt to call global 'wnd_create'(a nil value) 

Please help me. <3

Link to comment
  • Moderators

Maybe, try this:

local screenX, screenY = guiGetScreenSize( )
local label = guiCreateLabel( 0, 0, screenX, 15, "Purdi "..exports.global:getScriptVersion().."", false )
guiSetSize( label, guiLabelGetTextExtent( label ) + 5, 14, false )
guiSetPosition( label, screenX - guiLabelGetTextExtent( label ) - 5, screenY - 27, false )
guiSetAlpha( label, 0.5 )

addEventHandler('onClientMouseEnter', label, function()
	guiSetAlpha(label, 1)
end, false)

addEventHandler('onClientMouseLeave', label, function()
	guiSetAlpha(label, 0.5)
end, false)




addEventHandler('onClientGUIClick', function() 		
 -- i dont know what is this event, its looks useless
end, true)

function wnd_create(cmd, member, other)
	GUIEditor_TabPanel = {}
	GUIEditor_Tab = {}
	GUIEditor_Memo = {}
	GUIEditor_Image = {}


	window = guiCreateWindow(136,130,544,346,"Changelog",false)
	guiSetAlpha(window,1)
	guiWindowSetSizable(window,false)
	GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0404,0.2457,0.921,0.6936,true,window)
	guiSetAlpha(GUIEditor_TabPanel[1],1)
	tabcmd = guiCreateTab("ALTELE",GUIEditor_TabPanel[1])
	guiSetAlpha(tabcmd,1)
	GUIEditor_Memo[1] = guiCreateMemo(0.008,0.0231,0.984,0.9583,cmd,true,tabcmd)
	guiSetAlpha(GUIEditor_Memo[1],1)
	GUIEditor_Tab[1] = guiCreateTab("CASE",GUIEditor_TabPanel[1])
	guiSetAlpha(GUIEditor_Tab[1],1)
	GUIEditor_Memo[2] = guiCreateMemo(0.01,0.0324,0.98,0.9444,member,true,GUIEditor_Tab[1])
	guiSetAlpha(GUIEditor_Memo[2],1)
	GUIEditor_Tab[2] = guiCreateTab("MASINI",GUIEditor_TabPanel[1])
	guiSetAlpha(GUIEditor_Tab[2],1)
	GUIEditor_Memo[3] = guiCreateMemo(0.008,0.0185,0.982,0.963,other,true,GUIEditor_Tab[2])
	guiSetAlpha(GUIEditor_Memo[3],1)
	guiMemoSetReadOnly(GUIEditor_Memo[1],true)
	guiMemoSetReadOnly(GUIEditor_Memo[2],true)
	guiMemoSetReadOnly(GUIEditor_Memo[3],true)
end


addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), function ( theResource )
	if source == getResourceRootElement( theResource ) then
		local cmd = xmlLoadFile( "altele.xml" )
		local cmd1 = xmlNodeGetValue( cmd )
		local member = xmlLoadFile( "case.xml" )
		local member1 = xmlNodeGetValue( member )
		local other = xmlLoadFile( "masini.xml" )
		local other1 = xmlNodeGetValue( other )

		wnd_create( cmd1, member1, other1 )
	end
end)

 

Link to comment
  • Moderators
25 minutes ago, Purdi said:

It is working. But it opens when I start the resoure. I want to open the window when I click on the label.


local label = guiCreateLabel( 0, 0, screenX, 15, "Purdi "..exports.global:getScriptVersion().."", false )

 

Try this.

Maybe working, I never used gui.

 

local screenX, screenY = guiGetScreenSize( )
local label = guiCreateLabel( 0, 0, screenX, 15, "Purdi "..exports.global:getScriptVersion().."", false )
guiSetSize( label, guiLabelGetTextExtent( label ) + 5, 14, false )
guiSetPosition( label, screenX - guiLabelGetTextExtent( label ) - 5, screenY - 27, false )
guiSetAlpha( label, 0.5 )


addEventHandler('onClientMouseEnter', label, function()
	guiSetAlpha(label, 1)
end, false)

addEventHandler('onClientMouseLeave', label, function()
	guiSetAlpha(label, 0.5)
end, false)



local cmd = xmlLoadFile( "altele.xml" )
local cmd1 = xmlNodeGetValue( cmd )
local member = xmlLoadFile( "case.xml" )
local member1 = xmlNodeGetValue( member )
local other = xmlLoadFile( "masini.xml" )
local other1 = xmlNodeGetValue( other )

addEventHandler('onClientGUIClick', label, function()
	wnd_create(cmd1, member1, other1)
end)




function wnd_create(cmd, member, other)
	GUIEditor_TabPanel = {}
	GUIEditor_Tab = {}
	GUIEditor_Memo = {}
	GUIEditor_Image = {}


	window = guiCreateWindow(136,130,544,346,"Changelog",false)
	guiSetAlpha(window,1)
	guiWindowSetSizable(window,false)
	GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0404,0.2457,0.921,0.6936,true,window)
	guiSetAlpha(GUIEditor_TabPanel[1],1)
	tabcmd = guiCreateTab("ALTELE",GUIEditor_TabPanel[1])
	guiSetAlpha(tabcmd,1)
	GUIEditor_Memo[1] = guiCreateMemo(0.008,0.0231,0.984,0.9583,cmd,true,tabcmd)
	guiSetAlpha(GUIEditor_Memo[1],1)
	GUIEditor_Tab[1] = guiCreateTab("CASE",GUIEditor_TabPanel[1])
	guiSetAlpha(GUIEditor_Tab[1],1)
	GUIEditor_Memo[2] = guiCreateMemo(0.01,0.0324,0.98,0.9444,member,true,GUIEditor_Tab[1])
	guiSetAlpha(GUIEditor_Memo[2],1)
	GUIEditor_Tab[2] = guiCreateTab("MASINI",GUIEditor_TabPanel[1])
	guiSetAlpha(GUIEditor_Tab[2],1)
	GUIEditor_Memo[3] = guiCreateMemo(0.008,0.0185,0.982,0.963,other,true,GUIEditor_Tab[2])
	guiSetAlpha(GUIEditor_Memo[3],1)
	guiMemoSetReadOnly(GUIEditor_Memo[1],true)
	guiMemoSetReadOnly(GUIEditor_Memo[2],true)
	guiMemoSetReadOnly(GUIEditor_Memo[3],true)
end

 

Link to comment
33 minutes ago, Patrick2562 said:

 

Try this.

Maybe working, I never used gui.

 


local screenX, screenY = guiGetScreenSize( )
local label = guiCreateLabel( 0, 0, screenX, 15, "Purdi "..exports.global:getScriptVersion().."", false )
guiSetSize( label, guiLabelGetTextExtent( label ) + 5, 14, false )
guiSetPosition( label, screenX - guiLabelGetTextExtent( label ) - 5, screenY - 27, false )
guiSetAlpha( label, 0.5 )


addEventHandler('onClientMouseEnter', label, function()
	guiSetAlpha(label, 1)
end, false)

addEventHandler('onClientMouseLeave', label, function()
	guiSetAlpha(label, 0.5)
end, false)



local cmd = xmlLoadFile( "altele.xml" )
local cmd1 = xmlNodeGetValue( cmd )
local member = xmlLoadFile( "case.xml" )
local member1 = xmlNodeGetValue( member )
local other = xmlLoadFile( "masini.xml" )
local other1 = xmlNodeGetValue( other )

addEventHandler('onClientGUIClick', label, function()
	wnd_create(cmd1, member1, other1)
end)




function wnd_create(cmd, member, other)
	GUIEditor_TabPanel = {}
	GUIEditor_Tab = {}
	GUIEditor_Memo = {}
	GUIEditor_Image = {}


	window = guiCreateWindow(136,130,544,346,"Changelog",false)
	guiSetAlpha(window,1)
	guiWindowSetSizable(window,false)
	GUIEditor_TabPanel[1] = guiCreateTabPanel(0.0404,0.2457,0.921,0.6936,true,window)
	guiSetAlpha(GUIEditor_TabPanel[1],1)
	tabcmd = guiCreateTab("ALTELE",GUIEditor_TabPanel[1])
	guiSetAlpha(tabcmd,1)
	GUIEditor_Memo[1] = guiCreateMemo(0.008,0.0231,0.984,0.9583,cmd,true,tabcmd)
	guiSetAlpha(GUIEditor_Memo[1],1)
	GUIEditor_Tab[1] = guiCreateTab("CASE",GUIEditor_TabPanel[1])
	guiSetAlpha(GUIEditor_Tab[1],1)
	GUIEditor_Memo[2] = guiCreateMemo(0.01,0.0324,0.98,0.9444,member,true,GUIEditor_Tab[1])
	guiSetAlpha(GUIEditor_Memo[2],1)
	GUIEditor_Tab[2] = guiCreateTab("MASINI",GUIEditor_TabPanel[1])
	guiSetAlpha(GUIEditor_Tab[2],1)
	GUIEditor_Memo[3] = guiCreateMemo(0.008,0.0185,0.982,0.963,other,true,GUIEditor_Tab[2])
	guiSetAlpha(GUIEditor_Memo[3],1)
	guiMemoSetReadOnly(GUIEditor_Memo[1],true)
	guiMemoSetReadOnly(GUIEditor_Memo[2],true)
	guiMemoSetReadOnly(GUIEditor_Memo[3],true)
end

 

It is working, thank you brother. <3 <3 <3

 

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