Astelraid Posted December 22, 2005 Share Posted December 22, 2005 i want to do a cmd /register that would save the nick name and a password in a file. Whats the code for it? if someone would be so kind to post that here. Link to comment Share on other sites More sharing options...
robo85045 Posted December 24, 2005 Share Posted December 24, 2005 for that, you would need a LOT of code... and judging by the way you asked, I don't think you really understand how to program that well, so much of it wont make sense. anyway, here is some code from my mod, if you need help with it contact me at the forums I share: bwap.pipobona.com, If you register, you get access to the c++ help area, where ive allready posted some code (a lugormod-like /place command, and a /playerscale command so far, I post more as its requested) to save a nick file you will need somthing like qboolean SaveNickFile(char FileName[MAX_STRING_CHARS], char FileSaveData[MAX_STRING_CHARS]){ char TempFileName[MAX_STRING_CHARS]; if(strlen(FileSaveData) <= 0) return qfalse; if(!FileName || !FileName[0]) return qfalse; strcpy(TempFileName, "nicks\\"); strcat(TempFileName, FileName); TheFile = fopen(TempFileName, "w"); if(!TheFile) return qfalse; fwrite(FileSaveData, sizeof( char ), strlen(FileSaveData) , TheFile); fclose( TheFile ); strcpy(FileSaveData, ""); NextNickSave = level.time + NICKNAME_SAVE_RATE; return qtrue; } for the profession system, you will need a way of keeping track of the player login struct PlayerStruc_s{ char Name[MAX_NAME_CHARS]; char Pass[MAX_NAME_CHARS]; }; you will also need to add: PlayerStruc_s Nickname; to the typedef gclient_t for actualy formatting the names to save them, we could use somthing like: { Player Name Pass } so to format it (im making this code as i think of it, so it most likely will have a few bugs, the code I use for formatting the nickname saves is too complex for an example): qboolean SaveNicks( void ){ int i = 0; gclient_t *Client char SaveData[MAX_STRING_CHARS]; //this WILL be too small for a large database, if you use this code than change it for(i = 0;i<MAX_CLIENTS;i++){ Client = level.clients[i]; if(Client->Nickname){ strcat(SaveData, va({\n%s\n%s\n}\n", Client->Nickname->Name, Client->Nickname->Pass)); } } return SaveNickFile("nicknames.txt", SaveData); } urg, typing that in a forum window was almost as bad as that compiler they have at school... anyway, that is probably the bare minimum you could get away with for making a nickname saving system... I highly sugust that you learn c++ first, you should be able to make somthing like that no problem once you learn the basics Link to comment Share on other sites More sharing options...
ensiform Posted December 24, 2005 Share Posted December 24, 2005 you'd also want to encrypt the password because you wouldn't want the server (admin) to be able to see what all the pws are. Link to comment Share on other sites More sharing options...
robo85045 Posted December 26, 2005 Share Posted December 26, 2005 why would you want to do that? not like the admin will want to log in as others and, in a sence, 'hack their own server'. Link to comment Share on other sites More sharing options...
Jufa Posted December 26, 2005 Share Posted December 26, 2005 if you dont crypt the password ppl wont care to write down the password. they just ask you to look what it was and tell to them. also lugormod 1.2 has crypted passwords. since u got the source you could check how he did it Link to comment Share on other sites More sharing options...
ensiform Posted December 28, 2005 Share Posted December 28, 2005 xmod has md5 encrypted passwords :x Link to comment Share on other sites More sharing options...
axel364 Posted May 3, 2006 Share Posted May 3, 2006 I have a problem while using it... void Cmd_SaveNicks_f ( gentity_t *ent ) { int i; gclient_t *Client; for(i = 0;i<MAX_CLIENTS;i++){ Client = level.clients; if(Client->Name.Name){ WritePlayerStats(Client->Name.Name,2,2,1,5); } } } I have an error at the line Client = level.clients; Unable to convert from 'gclient_s' to 'gclient_t'... Can anyone help me please ? Link to comment Share on other sites More sharing options...
stubert Posted May 3, 2006 Share Posted May 3, 2006 md5 is a hashing algorythmn =x wot u talkin bout Link to comment Share on other sites More sharing options...
axel364 Posted May 3, 2006 Share Posted May 3, 2006 I'm not using md5 I try to use the code by robo. Link to comment Share on other sites More sharing options...
axel364 Posted May 5, 2006 Share Posted May 5, 2006 Hello, does anyone know please ? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.