14.07.2010, 20:22
Hi, I have serious problem with my payday function..
(my payday function below) Problem is: when I put return 1; under the function - payday dont work, but if I dont put return 1;, it works, but the function gets call every milisecond... I have settimerex under my onplayerlogin..
(my payday function below) Problem is: when I put return 1; under the function - payday dont work, but if I dont put return 1;, it works, but the function gets call every milisecond... I have settimerex under my onplayerlogin..
Код:
forward PayDay(playerid);
public PayDay(playerid)
{
for(new i=0; i < MAX_PLAYERS; i++)
{
new bmoney;
new string[200];
format(string, sizeof(string), "~p~payday!");
GameTextForPlayer(i,string,7000,6);
if(gTeam[i] == POLICE) { PMoney[i] = 1000 * Rank[i]; }
else if(gTeam[i] == FBI) { PMoney[i] = 2000 * Rank[i]; }
else if(gTeam[i] == MEDIC) { PMoney[i] = 800 * Rank[i]; }
else if(gTeam[i] == TAXLIM) { PMoney[i] = 500 * Rank[i]; }
else if(gTeam[i] == WARRIORS) { PMoney[i] = 700 * Rank[i]; }
else if(gTeam[i] == KNIGHT) { PMoney[i] = 700 * Rank[i]; }
else if(gTeam[i] == YAKUZA) { PMoney[i] = 700 * Rank[i]; }
if(Rank[i] == 6) { PMoney[i] += 1000; }
TaxMoney[i] = PMoney[i] / 100 * 5;
bmoney = PBAccount[i] / 100 * 1 + PBAccount[i];
SendClientMessage(i, COLOR_GREEN, "||----- Payday -----||");
format(string, sizeof(string), "|| salary: %d ||", PMoney[i]);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), "|| other: %d ||", PayCheck[i]);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), "|| Tax: %d (5 percent) ||", TaxMoney[i]);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), "|| Bank: %d (+1 percent) ||", bmoney);
SendClientMessage(i, COLOR_WHITE, string);
SendClientMessage(i, COLOR_GREEN, "||-----------------------||");
GivePlayerMoney(i, PMoney[i]);
GivePlayerMoney(i, PayCheck[i]);
GivePlayerMoney(i, -TaxMoney[i]);
//GivePlayerMoney(i, -Drugs[i]);
if(WantedLevel[i] >= 1) { WantedLevel[i] -= 1; }
if(GetPlayerMoney(i) < 0) { SetPlayerInJail(i); IsInDebt[i] = 1; }
RespectPoints[i] += 1;
PayCheck[i] = 0;
print("payday"); // this is the return 1 im talking about
return 1;
}
return 1;
}

