Paycheck Timer bugged - strcmp?
#1

Brief: This timer worked fine at one point early in development, but now it spams the chat with useless messages. I've been trying for the last few hours to fix it myself with no luck.

pawn Код:
forward PayCheckTimer(playerid);
public PayCheckTimer(playerid)
{
    biztotal[playerid] = 0;
    renttotal[playerid] = 0;
    bizcount[playerid] = 0;
    rentcount[playerid] = 0;
    if(!IsPlayerConnected(playerid)) return 1;
    for(new i=0;i<MAX_BIZ;i++)
    {
        if(!strcmp(bInfo[i][bowner], GetName(playerid), false))
        {
            GivePlayerMoney(playerid,bInfo[i][bincome]);
            new str[128];
            format(str,sizeof(str),"You earned $%i from owning %s.",bInfo[i][bincome],bInfo[i][bizname]);
            SCM(playerid, COLOR_GREEN, str);
            biztotal[playerid] += bInfo[i][bincome];
            bizcount[playerid]++;
        }
    }
    if(biztotal[playerid] != 0 && bizcount[playerid] > 1)
    {
        new str[128];
        format(str,sizeof(str),"You earned $%i from all your businesses.",biztotal[playerid]);
        SCM(playerid, COLOR_GREEN, str);
    }
    for(new i=0;i<MAX_HOUSE;i++)
    {
        if(!strcmp(hInfo[i][hrenter], GetName(playerid), false))
        {
            if(GetPlayerMoney(playerid) > hInfo[i][hrent])
            {
                new cash = hInfo[i][hrent];
                GivePlayerMoney(playerid, -cash);
                new str[128];
                format(str,sizeof(str),"You payed $%i from renting House %i.",hInfo[i][hrent], i);
                SCM(playerid, COLOR_WHITE, str);
                renttotal[playerid] += cash;
                rentcount[playerid]++;
            }
            else
            {
                new string[32] = "For Rent";
                hInfo[i][hrenter] = string;
                new str[128];
                format(str,sizeof(str),"You were evicted from House %i because you couldn't pay rent.",hInfo[i][hrent], i);
                SCM(playerid, COLOR_WHITE, str);
            }
        }
    }
    if(renttotal[playerid] != 0 && rentcount[playerid] > 1)
    {
        new str[128];
        format(str,sizeof(str),"You payed $%i from all your rented houses.",renttotal[playerid]);
        SCM(playerid, COLOR_GREEN, str);
    }
    return 1;
}
Reply
#2

What do u mean
Reply
#3

Quote:
Originally Posted by Need4samp
Посмотреть сообщение
What do u mean
Added screenshot.
Reply
#4

Look at this http://forum.sa-mp.com/showpost.php?...06&postcount=5
Reply
#5

Quote:
Originally Posted by Jefff
Посмотреть сообщение
That's what I needed, I just wasn't sure how to check if the variable was empty. Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)