Code:
pay2 = 0;
if ( auction->seller->pcdata->stats[LOAN] > 0 ) <--- so what you're saying is if he HAS a loan out
{
if( auction->seller->pcdata->stats[LOAN] < 0 ) <--- this part is in the wrong spot, we already know its > 0
{
pay2 = (int) auction->seller->pcdata->stats[LOAN] * 2;
pay2 = (int) pay2 / 2; <----^--------------- you're multiplying by 2, then dividing by 2.. just assign it
auction->seller->pcdata->stats[LOAN] = 0; <------ and then you're clearing the loan
}
else
{
pay2 = 0; <---- pay2 already = 0
}
auction->seller->gold += pay2; /* give him the money, tax 10 */
ch_printf( auction->seller,
"The auctioneer pays you %s zeni, charging an fee of ",
num_punct(pay2));
ch_printf( auction->seller, "%s.\n\r", num_punct(tax));
stc("&CThe Auctioneer says 'Since you owe the bank money I have given them what I could and given you the rest'&D", auction->seller );
}
else
{
auction->seller->gold += pay; /* give him the money, tax 10 % */
ch_printf( auction->seller,
"The auctioneer pays you %s zeni, charging an auction fee of ",
num_punct(pay));
ch_printf( auction->seller, "%s.\n\r", num_punct(tax));
}
ok .. now for the rest of it ... I think what you're trying to do is this ...
if( ch->loan > 0 )
pay2 = pay * 9 / 10;
if( ch->loan <= 0 )
pay2 = 0;
auction->seller->gold -= pay2;
ch->gold += auction->seller->gold;
if( pay2 > 0)
ch_printf( "Because of your bank loan, %d of your profits has been given to the bank.", pay2 );
ch_printf( "The auctioneer charges you %d zeni ..." ..... etc etc etc
this way you're making pay2 = the amount that is taken from the profits, removing it from the amount given to the player, and then continuing the normal auction proceedings ...
does this make sense or am I missing what you wanted to do?