Jaysds1 Posted March 17, 2011 Share Posted March 17, 2011 (edited) What should I edited in here? I created a gui with 2 buttons that should be linked to spawning a player. addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Progress = {} GUIEditor_Window[1] = guiCreateWindow(33,174,149,276,"Teams",false) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Button[2] = guiCreateButton(46,172,67,31,"Freeroamer",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[2],1) GUIEditor_Edit[1] = guiCreateEdit(36,39,92,43,"Select a Team",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Edit[1],1) guiEditSetReadOnly(GUIEditor_Edit[1],true) GUIEditor_Progress[1] = guiCreateProgressBar(24,238,112,29,false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Progress[1],1) guiProgressBarSetProgress(GUIEditor_Progress[1],100) end ) Edited July 7, 2011 by Guest Link to comment
proracer Posted March 17, 2011 Share Posted March 17, 2011 (edited) If you want to trigger function when player spawns use this: https://wiki.multitheftauto.com/wiki/OnClientPlayerSpawn Edit: Sorry, I understood wrong. Edited March 17, 2011 by Guest Link to comment
Moderators Citizen Posted March 17, 2011 Moderators Share Posted March 17, 2011 you have to add this event onClientGUIClick after the creation of your 2 buttons ( and where is your 1st button ? ^^ ): function spawnFreeroamer() outputChatBox("Spawn Freeroamer" ) -- you can hide your windows: guiSetVisible( GUIEditor_Window[1], false ) end addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Edit = {} GUIEditor_Progress = {} GUIEditor_Window[1] = guiCreateWindow(33,174,149,276,"Teams",false) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Button[2] = guiCreateButton(46,172,67,31,"Freeroamer",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[2],1) GUIEditor_Edit[1] = guiCreateEdit(36,39,92,43,"Select a Team",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Edit[1],1) guiEditSetReadOnly(GUIEditor_Edit[1],true) GUIEditor_Progress[1] = guiCreateProgressBar(24,238,112,29,false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Progress[1],1) guiProgressBarSetProgress(GUIEditor_Progress[1],100) -- execute spawnFreeroamer() if the GUIEditor_Button[2] is clicked: addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], spawnFreeroamer, false ) end ) 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