--- [EMAIL PROTECTED] wrote:
> Hey list, i've been slaving away at this for days. everything for a
> character that is offline works fine, but
> when i go to finger an online character, regardless of the name i put in, it
> shows me as the person i am fingering.
[SNIP]
Lets see what we can see..... (comments added to explain as we go)
[SNIP]
> if (found)
> {
/* Looping through each descriptor _again_ for some reason */
> for (d = descriptor_list; d; d = d->next)
> {
> CHAR_DATA *wch;
>
/* This can_see call is unnessicary as it will be taken care of
* 4 lines down
*/
> if (d->connected != CON_PLAYING || !can_see(ch,d->character))
> continue;
>
> wch = ( d->original != NULL ) ? d->original : d->character;
>
> if ( !can_see(ch,wch) )
> continue;
/* Ok, if this is the right guy found is now true if not it's
* false
*/
> if (!str_prefix(arg,wch->name))
> found = TRUE;
>
/* We didn't check for found here, so this is just whichever
* guy is first on the descriptor list
*/
> if(is_clan(wch))
> {
[SNIPPED data output]
> }
> if(!is_clan(wch))
> {
[SNIPPED data output]
> }
[SNIPPED data output]
> if(wch->desc != NULL)
[SNIPPED data output]
> else
[SNIPPED data output]
> send_to_char(buf, ch);
/* Ok, so now we've output a bunch of stuff for whomever was
* first on the descriptor list and we return out. Hopefully
* that was the right guy
*/
> return;
> }
> }
Doesn't seem like that code is all that useful. How about using :
void do_finger(CHAR_DATA *ch, char *argument)
{
FILE *fp;
char arg[MAX_INPUT_LENGTH];
char strsave[MAX_INPUT_LENGTH];
char buf[MAX_STRING_LENGTH];
char *name;
DESCRIPTOR_DATA *d;
bool found = FALSE;
char letter;
char *word;
CHAR_DATA *wch = NULL;
one_argument(argument,arg);
if (arg[0] == '\0')
{
send_to_char("You must provide a name.\n\r",ch);
return;
}
name = arg;
for (d = descriptor_list; d; d = d->next)
{
if (d->connected != CON_PLAYING)
continue;
wch = ( d->original != NULL ) ? d->original : d->character;
if ( !can_see(ch,wch) )
continue;
if (!str_prefix(arg,wch->name))
{
found = TRUE;
break;
}
}
if (found)
{
if(is_clan(wch))
{
sprintf(buf,"{R<{r<{xName{r>{R>{x:
{G%16s{x\n\r{G|{g<{xClan{g>{G|{x: %16s{x\n\r{B<{x|{CLevel{x|{B>: {x%14d{x\n\r",
wch->name, clan_table[wch->clan].who_name,wch->level);
send_to_char(buf, ch);
}
else
{
sprintf(buf,"{R<{r<{xName{r>{R>{x: {G%16s{x\n\r{B<{x|{CLevel{x|{B>:
{x%15d{x\n\r",
wch->name, wch->level);
send_to_char(buf, ch);
}
sprintf(buf, "{R<{x|{GClass{x|{R>{x: %16s\n\r",
class_table[wch->class].name);
send_to_char(buf, ch);
if(wch->desc != NULL)
sprintf(buf, "%s is currently playing {RF{ro{Rr{rg{Ro{rt{Rt{re{Rn
{DE{xm{Dp{xi{Dr{xe{D.{x\n\r",
wch->name);
else
sprintf(buf, "%s is currently linkdead.\n\r", wch->name);
send_to_char(buf, ch);
return;
}
else
/* begin real finger stuff */
Or something like that...
~Kender
=====
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/L/C/O d-(+) s++: a-- C+++$>++++ UBLS++++$
P+++(--)$ L+++>++++ E--- W+>++$ N !o K? w(--) !O
M- !V PS+ PE(++) Y+ PGP->+ t+ 5 X+() R(+) tv+@
b++(+++) !DI+++ D G(-) e>+++$ h---() r+++ y+++
------END GEEK CODE BLOCK------
__________________________________
Do you Yahoo!?
Exclusive Video Premiere - Britney Spears
http://launch.yahoo.com/promos/britneyspears/