01.06.2014, 00:06
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;
}