Solid Posted August 9, 2005 Share Posted August 9, 2005 wow... #include int main() { cout<<"The compiler works"; cin.get(); return 0; } lol j/k, thnx again JonChappell for the links to learn C++, you guys have kinda sparked my interest in this stuff. (Im such a n00b ) Link to comment
Kent747 Posted August 9, 2005 Share Posted August 9, 2005 nice man piece of advice (before it becomes a bad habit like it did for me) always use plenty of white space.. don't be afriad to indent your code a couple of spaces each time you have a { like this #include int main() { cout<<"The compiler works"; cin.get(); return 0; } It'll help down the line when you have really tricky functions w/ loops and if statements etc. Link to comment
njr1489 Posted August 9, 2005 Share Posted August 9, 2005 Yeah you should really tab out your work, so its more organized. It really helps when your backtracking to find mistakes. Link to comment
Solid Posted August 9, 2005 Author Share Posted August 9, 2005 roger, thnx for the tips. Link to comment
ChrML Posted August 9, 2005 Share Posted August 9, 2005 Hehe, nice to see you've started preparing for Blue . Keep it up and don't give up. I'm sure you can learn C++ well if you put enough efforts in it. Link to comment
paul527 Posted August 11, 2005 Share Posted August 11, 2005 i want to learn but i dont know any links Link to comment
ChrML Posted August 11, 2005 Share Posted August 11, 2005 http://www.cprogramming.com http://www.cplusplus.com Link to comment
Harry Posted August 12, 2005 Share Posted August 12, 2005 wow... #include int main() { cout<<"The compiler works"; cin.get(); return 0; } lol j/k, thnx again JonChappell for the links to learn C++, you guys have kinda sparked my interest in this stuff. (Im such a n00b ) wow.. real cool programming skill you have there... now you just have to learn how to spell. (btw: what does this have to do with MTA??) Link to comment
MrJax Posted August 12, 2005 Share Posted August 12, 2005 Cus he's trying to learn for when we can make our own mods with blue Link to comment
ChrML Posted August 12, 2005 Share Posted August 12, 2005 Just something I found on my disk that I poked together a long time ago. It's a quite cool commandline utility you can put in your system32 folder letting you type "uptime" in cmd whenever you like to show your computer's uptime. I think it's a quite good example showing off how variables and math is done even though might not be suitable for the very-beginners: #ifdef WIN32 #include #else #error This application requires Windows to compile! #endif #include int main(void) { //Get number of milliseconds since startup unsigned int time = GetTickCount(); //Weeks int weeks = time / 604800000; time = time%604800000; //Days int days = time / 86400000; time = time%86400000; //Hours int hours = time / 3600000; time = time%3600000; //Minutes int minutes = time / 60000; time = time%60000; //Seconds int seconds = time / 1000; time = time%1000; //Print the result printf("\nUptime is %d weeks, %d days, %d hours, %d minutes and %d seconds\n", weeks, days, hours, minutes, seconds); return 0; } And to make it clear, the % sign tells C / C++ to calculate the remainer... kinda the same thing as te Mod button on your calculator does. And btw, due to limitations with the GetTickCount () function, it will probably "wrap around" and show a fake number after 47 days. Link to comment
JacoB Posted August 13, 2005 Share Posted August 13, 2005 I'm not too fond of most of these online C++ tutorials because 99% of them teach console programming, when the majority of C++ programmers code win32 apps/DLLs. What's more important is string manipulation, datatype conversion, coding and using basic classes/functions, global vars, etc.. learning how to print something to a console won't help you code add-ons for Blue. Link to comment
god4u Posted August 13, 2005 Share Posted August 13, 2005 yaa not much difference in c and c++ c++ is more freindly and easier than C so those who know c should not have much problems with C++ and i am looking for a script which can the players client instead of kicking to get rid of some stupid noobs off tmy server. Anyone has that script? Link to comment
Gamefreek Posted August 13, 2005 Share Posted August 13, 2005 and i am looking for a script which can the players client instead of kicking to get rid of some stupid noobs off tmy server.Anyone has that script? Could you please rephrase that? Link to comment
god4u Posted August 13, 2005 Share Posted August 13, 2005 and i am looking for a script which can the players client instead of kicking to get rid of some stupid noobs off tmy server.Anyone has that script? Could you please rephrase that? Sure sir, Its a script which instead of kicking u off mta crashes ur mta client totally as if it was not even open. i make the client think of suspected trainer and crashes the persons game and client. I saw it once on some DJ mills server or something like that in uk server. Link to comment
Gamefreek Posted August 13, 2005 Share Posted August 13, 2005 I've never seen a script like that. Seems like a bit of overkill when kicking the person does the same thing.. The person could always reopen the client and join again.. Link to comment
god4u Posted August 13, 2005 Share Posted August 13, 2005 I've never seen a script like that. Seems like a bit of overkill when kicking the person does the same thing.. The person could always reopen the client and join again.. Ya but that one crashes ur game also say someone spawned as crusader to use the armor glitch than there is no way u can get rid of his armor and that script would really come in handy if only i could remember the server where i saw it . Link to comment
Kent747 Posted August 13, 2005 Share Posted August 13, 2005 I'm not too fond of most of these online C++ tutorials because 99% of them teach console programming, when the majority of C++ programmers code win32 apps/DLLs.What's more important is string manipulation, datatype conversion, coding and using basic classes/functions, global vars, etc.. learning how to print something to a console won't help you code add-ons for Blue. That may be true, but aside from some initial code for setting up your api calls, and handling events etc, the code you learn from doing console apps is well worth the easy implementation. Programmers earn their merit on being able to come up with a good algorithm, not from memorizing a bunch of API calls. Kent Link to comment
ChrML Posted August 13, 2005 Share Posted August 13, 2005 Heh, the man's gotta start somewhere. He can't start designing classes when he hardly knows how to make a console Hello world application, and btw some programs do better in C. Example, this is an equalent Hello World application doing it the "C++ way" (not tested): CApplication.h: #ifndef __CAPPLICATION_H #define __CAPPLICATION_H #include using namespace std; class CApplication { public: CApplication ( const string& strHelloWorld ); int Run ( void ); private: string m_strHelloWorld; }; #endif CApplication.cpp: #include "CApplication.h" #include CApplication::CApplication ( const string& strHelloWorld ) { m_strHelloWorld = strHelloWorld; } int CApplication::Run ( void ) { cout << m_strHelloWorld; return 0; } Main.cpp: #include "CApplication.h" int main ( void ) { CApplication* pApplication = new CApplication ( "Hello world!\n" ); int iReturn = pApplication->Run (); delete pApplication; return iReturn; } Link to comment
njr1489 Posted August 13, 2005 Share Posted August 13, 2005 You should start with hello world app tutorials, then buy a book to actually go somewhere. Learning hello world apps should give you a little understanding of what C++ is. Link to comment
Kent747 Posted August 13, 2005 Share Posted August 13, 2005 lol chrml we're trying to attract mod developers not scare them away from C++ Kent Link to comment
ChrML Posted August 13, 2005 Share Posted August 13, 2005 You should start with hello world app tutorials, then buy a book to actually go somewhere. Learning hello world apps should give you a little understanding of what C++ is. Exactly Yeah Kent, I'm just saying that some applications are better in C than C++. Other aren't, for a Blue mod is a lot easier to make in C++ (not that they can be made in C) Link to comment
Kent747 Posted August 13, 2005 Share Posted August 13, 2005 haha blueV1 had a C like interface for the mods. Link to comment
paul527 Posted August 13, 2005 Share Posted August 13, 2005 i have some questions. does c and c++ require more logic or math? and when im done will i be glad i learned it? and is there any free compilers out there? and what's 1337? (im a newbie) Link to comment
ChrML Posted August 13, 2005 Share Posted August 13, 2005 Hehe, 1337 is an attempt to digitalize the word leet . C++ won't require any special knowledge to math in itself. That depends very much on what you're writing. Ie, if you're writing a physics engine, you'll need tons of math, but I assume that you're planning to make a Blue mod since it's posted here. Our SDK (Software Development Kit) for Blue will contain a huge library for every aspect of the game, so you won't need to do any dirtywork or complex math when dealing with the game. You just need to know C++ and Object Oriented Programming (which obviously takes time and efforts to learn). There's a free set of compilers called GCC (MinGW is the Windows port) it's possible to use for C++ (and other languages), however I wouldn't recommend it to you as you're a newbie (you said). We use Microsoft Visual C++ 6 and .NET. I believe Kent's using a free version of .NET 2005 (correct?). Maybe Kent will give you a link. About learning C++, take your time and most importantly, don't give up. Feel free to ask any questions here since this has more or less turned into a programming thread anyway, lol , or at any C++ forum. Link to comment
Recommended Posts