SHARE
TWEET

Untitled

a guest May 31st, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void statsTrackRegister(gentity_t *ent, char password, char username[128])
  2. {
  3.     int len = 0;
  4.     fileHandle_t    f;
  5.     //char *buf = (char *)&ent->client->pers.save;
  6.  
  7.     if(ent->client->pers.loggedIn){
  8.         G_Printf("No need to register, you are already logged in.");
  9.         return;
  10.     }
  11.     SHA256_Data(&password, strlen(&password), ent->client->pers.save.password);
  12.     ent->client->pers.save.username = username;
  13.     G_Printf("Registering, please wait...");
  14.     len = trap_FS_FOpenFile(va("servdcc/%s.dcc", username), &f, FS_WRITE);
  15.     if(ent->client->pers.loggedIn){
  16.         G_Printf("No need to register, you are already logged in.");
  17.         return;
  18.     }
  19.     if(!f){ //no file, let's write a new one.
  20.         trap_FS_Write(&ent->client->pers.save, sizeof(ent->client->pers.save), f);
  21.         trap_FS_FCloseFile(f);
  22.         ent->client->pers.loggedIn = qtrue;
  23.         G_Printf("You are now registered, and logged in.\nUsername: %s\nPassword: %s", username, password);
  24.     }
  25.     else{ //check the password -- how?
  26.         G_Printf("A file by that name already exists.");
  27.         return;
  28.     }
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top