Hello guys,
I'm trying to write my first function and I'm getting some strange results.
if I type "bountyscan" with no argument, I'm getting a "They aren't here" response rather than the Usage bountyscan <target>
If I bounty scan an NPC, I'm getting the Indetification No match response rather than the you can't scan NPC response.
If I try to bounty scan myself or another player, I get an emergency copy over that prevents the crash so I don' have a core to work with. This is my first function that I pieced together after a view C tutorials and reviewing other functions within bounty.c
Can someone help me figure out what I'm doing wrong?
/* Allows bounty hunters to hunt players by identifying them with a scanner to see if they'e on the bounty list
for situations where they have not been introduced. Object may be required to be worn later..not sure. */
void do_bountyscan ( CHAR_DATA *ch, char *argument)
{
char arg[MAX_STRING_LENGTH];
BOUNTY_DATA *bounty;
CHAR_DATA *victim;
bounty = get_disintegration( victim->name );
if ( IS_NPC(victim))
{
send_to_char( "You cannot bountyscan an NPC\n\r", ch );
return;
}
if ((victim = get_char_room(ch, argument)) == NULL)
{
send_to_char("They aren't here.\n\r", ch);
return;
}
if (argument[0] == '\0' )
{
send_to_char( "Usage: bountyscan <target>\n\r", ch );
return;
}
if ( ch == victim )
{
send_to_char( "Why scan yourself, would you kill yourself for the money?\n\r", ch );
return;
}
if ( bounty != NULL )
{
ch_printf( ch, "Identification: Match! %s has a bounty worth %ld credits.\n\r", victim->name, bounty->amount );
return;
}
if (bounty == NULL)
{
send_to_char( "Identification: No Match!\n\r", ch );
return;
}
}
I'm trying to write my first function and I'm getting some strange results.
if I type "bountyscan" with no argument, I'm getting a "They aren't here" response rather than the Usage bountyscan <target>
If I bounty scan an NPC, I'm getting the Indetification No match response rather than the you can't scan NPC response.
If I try to bounty scan myself or another player, I get an emergency copy over that prevents the crash so I don' have a core to work with. This is my first function that I pieced together after a view C tutorials and reviewing other functions within bounty.c
Can someone help me figure out what I'm doing wrong?
/* Allows bounty hunters to hunt players by identifying them with a scanner to see if they'e on the bounty list
for situations where they have not been introduced. Object may be required to be worn later..not sure. */
void do_bountyscan ( CHAR_DATA *ch, char *argument)
{
char arg[MAX_STRING_LENGTH];
BOUNTY_DATA *bounty;
CHAR_DATA *victim;
bounty = get_disintegration( victim->name );
if ( IS_NPC(victim))
{
send_to_char( "You cannot bountyscan an NPC\n\r", ch );
return;
}
if ((victim = get_char_room(ch, argument)) == NULL)
{
send_to_char("They aren't here.\n\r", ch);
return;
}
if (argument[0] == '\0' )
{
send_to_char( "Usage: bountyscan <target>\n\r", ch );
return;
}
if ( ch == victim )
{
send_to_char( "Why scan yourself, would you kill yourself for the money?\n\r", ch );
return;
}
if ( bounty != NULL )
{
ch_printf( ch, "Identification: Match! %s has a bounty worth %ld credits.\n\r", victim->name, bounty->amount );
return;
}
if (bounty == NULL)
{
send_to_char( "Identification: No Match!\n\r", ch );
return;
}
}