SA-MP Forums Archive
Paycheck Timer bugged - strcmp? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Paycheck Timer bugged - strcmp? (/showthread.php?tid=516570)



Paycheck Timer bugged - strcmp? - Aerotactics - 01.06.2014

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;
}



Re: Paycheck Timer bugged - strcmp? - Need4samp - 01.06.2014

What do u mean


Re: Paycheck Timer bugged - strcmp? - Aerotactics - 01.06.2014

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


Re: Paycheck Timer bugged - strcmp? - Jefff - 01.06.2014

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


Re: Paycheck Timer bugged - strcmp? - Aerotactics - 01.06.2014

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