23.01.2011, 21:26
(
Последний раз редактировалось BizzyD; 24.01.2011 в 11:59.
)
Hello, i got a problem with my payday system. When it gets payday time. And we have to do /signcheck. But the money dosent get into the bank account. It dosent update at all.
Here is my code:
Thanks, Alex
EDIT: Here is a picture where you can see that the bank account dosent update.
Here is my code:
pawn Код:
if(strcmp(cmd, "/signcheck", true) == 0)
{
//new string[128];
new account,interest;
if(!strlen(cmdtext[11]))
{
SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /signcheck [check number]");
return 1;
}
new number = strval(cmdtext[11]);
if(number < 1000 || number > 9999) { SendClientMessage(playerid, COLOR_GREY, " You can't use that check number"); return 1; }
if(number == CheckNumber[playerid])
{
//new sendername[MAX_PLAYER_NAME];
new tmpintrate = 1; //interest rate
new viptmpintrate = 2; // vip interest rate
//if(PlayerInfo[playerid][pHouseAccepted] == 1){ tmpintrate = 2; }
if(PlayerInfo[playerid][pDonateRank] == 1){ tmpintrate = 2; }
GetPlayerName(playerid, sendername, sizeof(sendername));
account = PlayerInfo[playerid][pAccount]; //bank account amount
if(PlayerInfo[playerid][pPayDay] >= 5)
{
new checks = PlayerInfo[playerid][pPayCheck]; //paycheck amount
new incometax = PlayerInfo[playerid][pPayCheck] / 100 * Tax; //income tax amount
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+checks-incometax; //give money
GivePlayerMoney(playerid, checks-incometax); //give money
//TAX MONEY
TaxValue = TaxValue+incometax;
//ELECTRICITY
new randomv = random(1000);
new ebill = (randomv*PlayerInfo[playerid][pHouseLevel])/2;
if(PlayerInfo[playerid][pHouseLevel] && PlayerInfo[playerid][pHouseAccepted])
{
PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-ebill; //give money
GivePlayerMoney(playerid, -ebill); //give money
}
//INTEREST
if(VIPGold[playerid] != 1)
{
interest = (PlayerInfo[playerid][pAccount]/1000)*(tmpintrate); //bank interest
PlayerInfo[playerid][pAccount] = account+interest; //add interest money to bank
}
else if(VIPGold[playerid] == 1)
{
interest = (PlayerInfo[playerid][pAccount]/1000)*(viptmpintrate);//bank vip interest
PlayerInfo[playerid][pAccount] = account+interest; //add interest money to bank
}
//EXP
PlayerInfo[playerid][pExp]++; //experience points
SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATEMENT ___|");
format(string, sizeof(string), " Paycheck: $%d", checks);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " Income Tax: -$%d", incometax);
SendClientMessage(playerid, COLOR_GRAD1, string);
if(PlayerInfo[playerid][pHouseLevel] && PlayerInfo[playerid][pHouseAccepted])
{
format(string, sizeof(string), " Electricity Bill: -$%d", ebill);
SendClientMessage(playerid, COLOR_GRAD1, string);
}
format(string, sizeof(string), " Balance: $%d", account);
SendClientMessage(playerid, COLOR_GRAD1, string);
format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate);
SendClientMessage(playerid, COLOR_GRAD2, string);
format(string, sizeof(string), " Interest Gained $%d", interest);
SendClientMessage(playerid, COLOR_GRAD3, string);
SendClientMessage(playerid, COLOR_GRAD4, "|------------------------------------------|");
format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD5, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
GameTextForPlayer(playerid, string, 5000, 1);
PlayerInfo[playerid][pPayDay] = 0;
PlayerInfo[playerid][pPayCheck] = 0;
PlayerInfo[playerid][pConnectTime] += 1;
}
else
{
SendClientMessage(playerid, COLOR_LIGHTRED, "* You haven't played long enough to obtain a Paycheck.");
}
}
}
EDIT: Here is a picture where you can see that the bank account dosent update.