home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
WWIVMODS
/
MODSUNKN.ZIP
/
TOPTEN1.MOD
< prev
next >
Wrap
Text File
|
1992-01-07
|
6KB
|
221 lines
TOP TEN USER MOD
by GNR 1@2395
This will print out a Gfile with the top ten users in different
categories:
Most Upload k, Most Download k, Logons, Posts, Best Ratio. When
a user logs on and he looks at the file, his name will be
highlighted if his name is in on of the top ten lists. The sysop
is NOT included in these lists.
In this function I have the directory where my file is stored,
change it to the directory you want it stored, but leave the name
of the file (topusers.msg) and the double \ are not mistakes.
Put this after any function in sysopf1.c
void check_top()
{
FILE *tpusers;
int count,count2,count3,count4,number,true;
char topnames[5][10][30],title[55];
long topk[5][10],cur;
userrec u;
for(count=0;count<=4;count++)
{
for(count2=0;count2<=9;count2++)
{
strcpy(topnames[count][count2],">NOBODY<");
topk[count][count2]=0;
}
}
number=(int)(filelength(userfile)/sizeof(userrec))-1;
for(count=2;count<=number;count++)
{
read_user(count,&u);
if(!((u.inact) & inact_deleted))
{
for(count2=0;count2<=4;count2++)
{
switch(count2)
{
case 0:
cur=u.uk;
break;
case 1:
cur=u.dk;
break;
case 2:
cur=u.logons;
break;
case 3:
cur=u.msgpost;
break;
case 4:
if(u.dk!=0)
cur=((float) u.uk)/((float) u.dk);
if(cur>=100) cur=99.998;
break;
}
true=0;
for(count3=9;((count3>=0) && (true==0));count3--)
{
if(cur>topk[count2][count3])
{
for(count4=0;(count4<count3);count4++)
{
topk[count2][count4]=topk[count2][count4+1];
strcpy(topnames[count2][count4],topnames[count2][count4+1]);
}
topk[count2][count3]=cur;
if(strcmp(thisuser.name,u.name)==0)
{
strcpy(topnames[count2][count3],"\x1b[1;32m");
strcat(topnames[count2][count3],u.name);
strcat(topnames[count2][count3],"\x1b[0m");
}
else
strcpy(topnames[count2][count3],u.name);
true=1;
}
}
}
close_user();
}
}
tpusers=fopen("GFILES\\TOPTEN\\TOPUSERS.MSG","w"); /* <----
*/
fprintf(tpusers,"GNR's Top Ten User List.\n");/* Put your
own name! */
fprintf(tpusers,"\n");
for(count=0;count<=4;count++)
{
switch(count) {
case 0:
strcpy(title,"MOST UPLOAD k\n\n");
break;
case 1:
strcpy(title,"MOST DOWNLOAD k\n\n");
break;
case 2:
strcpy(title,"MOST LOGONS\n\n");
break;
case 3:
strcpy(title,"MOST POSTS\n\n");
break;
case 4:
strcpy(title,"BEST RATIO\n\n");
break;
}
fprintf(tpusers,title);
for(count2=9;count2>=0;count2--)
{
fprintf(tpusers,"%s",topnames[count][count2]);
for(count3=0;count3<(50-strlen(topnames[count][count2]));count3++
)
{
fprintf(tpusers,".");
}
if(strchr(topnames[count][count2],'[')!=NULL)
{
for(count4=0;count4<11;count4++)
fprintf(tpusers,".");
}
fprintf(tpusers,"%d",topk[count][count2]);
fprintf(tpusers,"\n");
}
fprintf(tpusers,"\n");
}
fclose(tpusers);
-----------------------------------------------------------------
-----------
Put in FCNS.H
void check_top();
-----------------------------------------------------------------
-----------
Find void logon() in BBSUTL.C and add the text marked with a +.
*****************************************************************
************
* prompt("Birthdate: ",s,". Correct? ","");
*
* if (!yn())
*
* thisuser.year=0;
*
* } while ((!hangup) && (thisuser.year==0));
*
* topscreen();
*
* nl();
*
* }
*
*
*
* + prt(2,"Updating GNR's Top Ten User List!"); /* Put your
own name! */*
* + check_top();
*
* + nl();
*
*
*
* rsm(usernum,&thisuser);
*
*****************************************************************
************
Reposition the above lines so that they are before the external
call for the
logon event. As Written the Logon event for some reason cause
this mod not
to print the stats just the file with a bunch of >NOBODY<'s and
0's....
You will notice that if you have the mod in as written and you
go into init
and take out the logon event it will work.... I just moved the
call so it was
done before the logon event....
*****************************************************************
************
if (live_user)
topscreen();
+ prt(2,Updating XXXXX's Top Ten User List!");
+ check_top();
+ nl();nl();
if ((syscfg.logon_c[0]) && live_user) {
nl();
Strcpy(s1,syscfg.logon_c);
*****************************************************************
**************
That should be it, any problems email 1 @ 2395 or call The
Nuclear Reactor
BBS (213) 271-4232.
Modified By ─∞∞─« Dartvader »─∞∞─ 12-17-89