XeClutch Posted February 9, 2013 Share Posted February 9, 2013 (edited) Working on my first GTA4 Menu (its done + its a private patch) and I get this.... All of the code appears the same and before it gave me an error with line 820 but thats gone now... PLZ HELP! Edited February 9, 2013 by XeClutch Link to comment Share on other sites More sharing options...
pedro2555 Posted February 9, 2013 Share Posted February 9, 2013 Working on my first GTA4 Menu (its done + its a private patch) and I get this.... All of the code appears the same and before it gave me an error with line 820 but thats gone now... PLZ HELP! use visual studio Link to comment Share on other sites More sharing options...
Hanneswasco Posted February 9, 2013 Share Posted February 9, 2013 while( if( bool expression ) ) { ... } is not how you use a while-loop. Make it while( bool expression ) { ... }, so without the if, and it should compile. Link to comment Share on other sites More sharing options...
XeClutch Posted February 10, 2013 Author Share Posted February 10, 2013 while( if( bool expression ) ) { ... } is not how you use a while-loop. Make it while( bool expression ) { ... }, so without the if, and it should compile. lol, I am new to GTA coding, can you maybe send me the proper code? It is a private patch, I am not releasing it but I can give it to you if you can get me the code Link to comment Share on other sites More sharing options...
pedro2555 Posted February 11, 2013 Share Posted February 11, 2013 (edited) while( if( bool expression ) ) { ... } is not how you use a while-loop. Make it while( bool expression ) { ... }, so without the if, and it should compile. lol, I am new to GTA coding, can you maybe send me the proper code? It is a private patch, I am not releasing it but I can give it to you if you can get me the code I really suggest you to download Visual Studio, not only it can compile for you with the proper settings for debug/release but it can also 'tell you' that your code has errors, where are they, why are they being caused and sometimes how to fix them. (And you can reduce the amount of 'typing' by 70% or more). For general application development, breakpoints are super usefull. while (item_select == 3){+} 'item_select == 3' it's what's called a boolean expression, boolean because it doens't affect any of the operands, instead it returns a value of true or false. (true if item_select is 3, false otherwise). Also be aware that this code breaks execution of all other lines in the same thread, as long as item_select is 3. This is not ideal. (assuming you are not working with multiple threads) If what you want to do is perform multiple checks on a single variable and execute different code on different values, a switch is the proper tool for the job. Here is how to use: switch (item_select){ case 0: // code for the 0 case break; case 1: // code for the 1 case break;// and so on default: // default behaviour, executed for all cases not meet above. break;} You can also stack 'case's, just insert them before any break statment, like this: switch (item_select){ case 0: case 1: // code for the 1 and 0 case break; default: break;} And remember that this is not GTA code, this is C# code. So learning good C# practices will help you more than a lot. Edited February 11, 2013 by pedro2555 Link to comment Share on other sites More sharing options...
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