C++ My first script (Loginprompt)

Discussion in 'Programming General' started by Frt, Jan 26, 2009.

C++ My first script (Loginprompt)
  1. Unread #1 - Jan 26, 2009 at 2:17 PM
  2. Frt
    Joined:
    Oct 14, 2007
    Posts:
    15
    Referrals:
    0
    Sythe Gold:
    0

    Frt Newcomer

    C++ My first script (Loginprompt)

    Hi guys,

    I've been reading a bit on the forum and I've tried to learn C++ and so far I think I'm making progress.

    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    const string uc = "Username";
    const string pc = "Password";
    
    string username,password;
    int id;
    bool result;
    
    bool login(string u,string p) {
         if(u == uc && p == pc) return(true);
         if(u != uc || p != pc) return(false);
    }
    
    int setid(string u) {
         if(u == uc) return(1);
    }
    
    int main(int argc, char *argv[])
    {
          cout << "Username: ";
          cin >> username;
          cout << "Password: ";
          cin >> password;
          result = login(username,password);
          if(result == true) id = setid(username);
          cout << "Welcome " << username << ", you have been logged in and your ID is " << id;
          Sleep("2000");
    }
    
    I know that the script is easy to improve. For example you could add an array so you could add multiple users, but I wasn't quite sure on how to do this so I didn't put an effort into doing this :)

    Btw: Can you suggest some great tutorials for learning to make program in C++ that moves mouse, sends keys and so on?

    I'm aiming towards making an Autofighter some day and perhaps an Aimbot for Counter Strike :)
     
  3. Unread #2 - Jan 26, 2009 at 6:26 PM
  4. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    C++ My first script (Loginprompt)

    This isn't a script. A script is usually something like a text file that is parsed by an application, for example, JavaScript in Windows Script files.

    As for learning to make aimbots and whatnot, I can only say this: LEARN TO PLAY THE GAME. Partially because of people who use aimbots that I don't play CS much any more.

    And for tutorials, http://www.google.com/.
     
  5. Unread #3 - Jan 26, 2009 at 10:44 PM
  6. tofurocks
    Joined:
    Nov 8, 2008
    Posts:
    2,344
    Referrals:
    2
    Sythe Gold:
    0

    tofurocks Iloveroy

    C++ My first script (Loginprompt)

    Nevermind.
     
  7. Unread #4 - Jan 27, 2009 at 2:56 AM
  8. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    C++ My first script (Loginprompt)

    Idiot - C++ is faster than some of the most common languages used to create RuneScape bots, including Visual Basic. The reason yours went slow is because you're checking each pixel individually - look in to the GetDIBits function.
     
  9. Unread #5 - Jan 27, 2009 at 2:30 PM
  10. tofurocks
    Joined:
    Nov 8, 2008
    Posts:
    2,344
    Referrals:
    2
    Sythe Gold:
    0

    tofurocks Iloveroy

    C++ My first script (Loginprompt)

    Thanks for that. I know that C++ is used a lot, but I thought that it's still not as powerful as Java for RS. SMR gave me the GetPixel idea so I thought it was solid :(
     
  11. Unread #6 - Jan 28, 2009 at 3:04 AM
  12. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    C++ My first script (Loginprompt)

    Java is good for creating RS cheats because you can hook the RS applet and interface with it easier than you could with other languages, and so on.
     
  13. Unread #7 - Mar 11, 2009 at 10:11 PM
  14. PublicityFtF
    Joined:
    Mar 10, 2009
    Posts:
    1,178
    Referrals:
    0
    Sythe Gold:
    0

    PublicityFtF Guru
    Banned

    C++ My first script (Loginprompt)


    Learn OpenGL for that; you really only need the c++ for dll injection.
     
  15. Unread #8 - Apr 26, 2009 at 9:18 PM
  16. WantCheapGold?
    Joined:
    Apr 26, 2009
    Posts:
    6
    Referrals:
    0
    Sythe Gold:
    0

    WantCheapGold? Newcomer

    C++ My first script (Loginprompt)

    Dont you c++ for that:) just complicates shit.... use java instead its much easier and better for that kinda thing like aimbots and stuff:)
     
  17. Unread #9 - May 5, 2009 at 8:13 PM
  18. pvash2
    Joined:
    May 5, 2009
    Posts:
    23
    Referrals:
    0
    Sythe Gold:
    0

    pvash2 Newcomer

    C++ My first script (Loginprompt)

    There is a market in cheating/hacking for games ya' know? Learning C++ to write a hack could be a motivation to learn, that is how it was for me at least.
    Charging $15 Per Month Per user for a multi-hacking tool for lets say, Counter-Strike, and imagine about 100 active, paying users.

    $1500 Per Month (give or take a few due to web-domain), why not stop there? Expand your knowledge, learn more and offer what other cheat-providers haven't or cannot
     
  19. Unread #10 - May 6, 2009 at 2:20 PM
  20. WoWnub
    Joined:
    Nov 15, 2008
    Posts:
    347
    Referrals:
    0
    Sythe Gold:
    0

    WoWnub Forum Addict
    Banned

    C++ My first script (Loginprompt)

    I don't understand what does this script do?

    Care to explain?
     
  21. Unread #11 - May 6, 2009 at 3:52 PM
  22. pvash2
    Joined:
    May 5, 2009
    Posts:
    23
    Referrals:
    0
    Sythe Gold:
    0

    pvash2 Newcomer

    C++ My first script (Loginprompt)

    Well it is NOT a script, please read all posts...

    What this does is, asks for input/ for username and password
    then whatever is input is compared to 2 strings using the '==' (equal to) statement, then using the 'If' statement, it checks to see whether it WAS equal to or not, if not, then it does not go any further, otherwise if it was equal to then it continues onto printing the username and password on the screen, along with a welcome statement.
     
  23. Unread #12 - Jun 17, 2009 at 12:07 PM
  24. Muneeb
    Joined:
    May 23, 2009
    Posts:
    70
    Referrals:
    1
    Sythe Gold:
    0

    Muneeb Member

    C++ My first script (Loginprompt)

    That isnt really a script is it?
     
  25. Unread #13 - Jun 17, 2009 at 1:03 PM
  26. hampe-92
    Joined:
    Jul 10, 2008
    Posts:
    328
    Referrals:
    0
    Sythe Gold:
    0

    hampe-92 Forum Addict

    C++ My first script (Loginprompt)

    no it's not... you aren't spamming are you? ^^
     
  27. Unread #14 - Aug 19, 2009 at 8:26 PM
  28. new user 1000
    Joined:
    Jul 13, 2009
    Posts:
    211
    Referrals:
    0
    Sythe Gold:
    0

    new user 1000 Active Member
    Banned

    C++ My first script (Loginprompt)

    Scar is good for writing RS Bots, easy to learn too.
     
  29. Unread #15 - Aug 20, 2009 at 2:09 AM
  30. super_
    Joined:
    Dec 20, 2008
    Posts:
    91
    Referrals:
    0
    Sythe Gold:
    0

    super_ Member

    C++ My first script (Loginprompt)

    loooooooooooool
     
  31. Unread #16 - Nov 23, 2009 at 12:59 AM
  32. Goomba
    Joined:
    Nov 21, 2009
    Posts:
    100
    Referrals:
    0
    Sythe Gold:
    0

    Goomba Active Member

    C++ My first script (Loginprompt)

    Nice Job For A 1st Script Bud :) But Its Not Really A Script Though, maybe you could add a few arrays etc.
     
  33. Unread #17 - Nov 23, 2009 at 11:47 AM
  34. super_
    Joined:
    Dec 20, 2008
    Posts:
    91
    Referrals:
    0
    Sythe Gold:
    0

    super_ Member

    C++ My first script (Loginprompt)

    1. global variables pollute the global namespace :-(
    2. using an entire namespace does too :-(
    3. login()'s logic is redundant:
    Code:
         if(u == uc && p == pc) return(true);
         if(u != uc || p != pc) return(false);
    
    ->
    Code:
        return u == uc && p == pc;
    4. there should really be a space between return and the return value, and you should use redundant parentheses when they aren't used for clarification.
    5.
    Code:
          if(result == true) id = setid(username);
    
    that if-condition can be simplified to just:
    Code:
    if (result)
    6. this isn't a script :)
    7. Sleep() takes a number of milliseconds... not in string form; you're probably doing an implicit conversion between pointer to int and sleeping for a very strange number of milliseconds.
    8. using Sleep() to avoid the console closing immediately can be avoided by running the program from the terminal/shell/command prompt.
    9. breaking cross-platform compatibility to do that is stupid
    10. c++ isn't required for dlls
    11. == is an operator not a statement
    12. this is a long list
     
  35. Unread #18 - Nov 23, 2009 at 11:49 AM
  36. super_
    Joined:
    Dec 20, 2008
    Posts:
    91
    Referrals:
    0
    Sythe Gold:
    0

    super_ Member

    C++ My first script (Loginprompt)

    13. very insecure-- valid login can be found via a simple text editor
    14. prints out welcome with valid username even if supplied with invalid username.
    15. prints out junk id if invalid username supplied
    16. misleading function names
    17. this is now a longer list
     
< using external dll | How did LeoSleep work for RSC? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site