Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main(void)
- {
- //usleep(500000);
- FILE*in=fopen("players.txt","r");
- FILE*out=fopen("players.cfg","w");
- FILE*help=fopen("phelp.cfg","w");
- if (!in) {puts("Not found.");return 1;}
- char name[50];
- int id;
- char c;
- char flag=0;
- while (!feof(in))
- {
- if (!flag) fgets(name,50,in);
- //printf("%s",name);
- if (fscanf(in,"%d: ",&id)&&flag)
- {
- fgets(name,50,in);
- if (strstr(name," total players\n")) break;
- *strchr(name,'\n')=0;
- printf("%s\n",name);
- }
- else fgets(name,30,in);
- if (!flag&&strstr(name,"----------")) {flag=1;}
- }
- puts("-----------------------------------");
- flag=0;
- fseek(in,0,SEEK_SET);
- while (!feof(in))
- {
- if (!flag) fgets(name,50,in);
- if (fscanf(in,"%d: ",&id)&&flag)
- {
- fgets(name,50,in);
- if (strstr(name," total players\n")) break;
- *strchr(name,'\n')=0;
- printf("%s ",name);c=getc(stdin);if (c!='\n') getc(stdin);
- //printf("BIND %c follow %d\n",c,id);
- if (c==' ') break;
- if (c!='\n') fprintf(out,"BIND %c follow %d\n",c,id);
- if (c!='\n') fprintf(help,"echo \"BIND %c follow %d\"\n",c,id);
- }
- else fgets(name,30,in);
- if (!flag&&strstr(name,"----------")) {flag=1;}
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement