Franky Posted October 8, 2008 Share Posted October 8, 2008 function analyseGui ( ) analysegui = guiCreateWindow ( 0.3, 0.25, 0.4, 0.5, "Analysing results", true ) space1 = guiCreateGridList ( 0.015, 0.06, 0.483, 0.1, true, analysegui ) space2 = guiCreateGridList ( 0.512, 0.06, 0.483, 0.1, true, analysegui ) space3 = guiCreateGridList ( 0.015, 0.18, 0.483, 0.1, true, analysegui ) space4 = guiCreateGridList ( 0.512, 0.18, 0.483, 0.1, true, analysegui ) space5 = guiCreateGridList ( 0.015, 0.3, 0.985, 0.6, true, analysegui ) closeBTN = guiCreateButton ( 0.8, 0.92, 0.2, 0.098, "Close", true, analysegui ) guiSetVisible ( analysegui, false ) end addEventHandler( "onClientResourceStart", getResourceRootElement ( getThisResource ( ) ), analyseGui ) function analyseCMD ( thePlayer, commandName ) guiSetVisible ( analysegui, true ) showCursor ( true ) guiSetInputEnabled ( true ) end addCommandHandler ( "analyse", analyseCMD ) function onGuiClose ( ) showCursor ( false ) guiSetVisible ( analysegui, false ) guiSetInputEnabled ( false ) end addEventHandler ( "onClientGUIClick", closeBTN, onGuiClose, false ) Link to comment
Gamesnert Posted October 8, 2008 Share Posted October 8, 2008 ... What's wrong with it... I'm not going to copy it to find out, if you think I am. Give us some info. Link to comment
Franky Posted October 9, 2008 Author Share Posted October 9, 2008 ... What's wrong with it... I'm not going to copy it to find out, if you think I am. Give us some info. Sorry i forgot:D it gives me an error like "Bad argument @ line 26 "addEventHandler" " or something like that.. it doesn't give it in the console, it in the debug script. Link to comment
Willy Posted October 9, 2008 Share Posted October 9, 2008 at the top of your script write: local closeBTN Link to comment
Gamesnert Posted October 9, 2008 Share Posted October 9, 2008 ... What's wrong with it... I'm not going to copy it to find out, if you think I am. Give us some info. Sorry i forgot:D it gives me an error like "Bad argument @ line 26 "addEventHandler" " or something like that.. it doesn't give it in the console, it in the debug script. Ah ok! Anyway, improved version: function analyseGui ( ) analysegui = guiCreateWindow ( 0.3, 0.25, 0.4, 0.5, "Analysing results", true ) space1 = guiCreateGridList ( 0.015, 0.06, 0.483, 0.1, true, analysegui ) space2 = guiCreateGridList ( 0.512, 0.06, 0.483, 0.1, true, analysegui ) space3 = guiCreateGridList ( 0.015, 0.18, 0.483, 0.1, true, analysegui ) space4 = guiCreateGridList ( 0.512, 0.18, 0.483, 0.1, true, analysegui ) space5 = guiCreateGridList ( 0.015, 0.3, 0.985, 0.6, true, analysegui ) closeBTN = guiCreateButton ( 0.8, 0.92, 0.2, 0.098, "Close", true, analysegui ) addEventHandler ( "onClientGUIClick", closeBTN, onGuiClose, false ) guiSetVisible ( analysegui, false ) end addEventHandler( "onClientResourceStart", getResourceRootElement ( getThisResource ( ) ), analyseGui ) function analyseCMD ( thePlayer, commandName ) guiSetVisible ( analysegui, true ) showCursor ( true ) guiSetInputEnabled ( true ) end addCommandHandler ( "analyse", analyseCMD ) function onGuiClose ( ) showCursor ( false ) guiSetVisible ( analysegui, false ) guiSetInputEnabled ( false ) end What I did, and why: The addEventHandler is now inside analyseGui function. Reason? Everything outside any events is triggered/initiated before the ones inside events/functions. In other words, if you put for example: addEventHandler("onPlayerWasted",getRootElement(),playerRespawn) function playerRespawn() [..] end That won't work. The addEventHandler was executed BEFORE it knew what playerRespawn actually means. Get it? ^^ So even if the even is onClientResourceStart, the things outside of functions are ALWAYS triggered/initiated earlier! (or well, I don't know any exceptions... ) Link to comment
Franky Posted October 9, 2008 Author Share Posted October 9, 2008 at the top of your script write:local closeBTN still the same.. "Bad argument @ "addEventHandler" line 26" 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