[HELP]Bank interest -
[Aka]Dragonu - 02.09.2011
Hello again, I made a bank interest sistem to give you 2% of your total stored in bank money every payday, but for example if I have stored in bank 100.000$ and on payday I recieve from interest let's say 1040$ it will only deposit 1000$ and the other 40$ not, why is that ? Here is the script :
pawn Код:
new string[128];
for(new i=0; i<MAX_SLOTS; i++)
{
//if(IsPlayerConnected(i))
//{
format(string, sizeof(string), "_______< Bank of %s >________", GAMEMODE_MAP);
SendClientMessage(i, COLOR_BLUE, string);
format(string, sizeof(string), " Level: %d, Exp: %d", PlayerInfo[i][pLevel], PlayerInfo[i][pExp]);
SendClientMessage(i, COLOR_GREY, string);
format(string, sizeof(string), " Balance: %d$", PlayerInfo[i][pBank]);
SendClientMessage(i, COLOR_GREY, string);
format(string, sizeof(string), " Drugs: %d gram.", PlayerInfo[i][pDrugs]);
SendClientMessage(i, COLOR_GREY, string);
PlayerInfo[i][pExp] ++;
if(PlayerInfo[i][pVip] == 1){PlayerInfo[i][pExp] ++;} // 1 Extra exp for vips.
if(gTeam[i] != TEAM_COP && gTeam[i] != TEAM_ARMY)
{
PlayerInfo[i][pDrugs] += 2;
if(PlayerInfo[i][pVip] == 1){PlayerInfo[i][pDrugs] += 3;}
} // 1 Extra gram drugs for vips.
PlayerInfo[i][pBank] = PlayerInfo[i][pBank]+PlayerInfo[i][pBank]*2/100;
if(PlayerInfo[i][pExp] >= PlayerInfo[i][pLevel])
{
PlayerInfo[i][pExp] = 0;
PlayerInfo[i][pLevel] ++;
}
SendClientMessage(i, COLOR_WHITE, "|--------------------------------------------------|");
format(string, sizeof(string), " New Level: %d, New Exp: %d", PlayerInfo[i][pLevel], PlayerInfo[i][pExp]);
SendClientMessage(i, COLOR_GREY, string);
format(string, sizeof(string), " New Balance: %d$", PlayerInfo[i][pBank]);
SendClientMessage(i, COLOR_GREY, string);
format(string, sizeof(string), " Bank Interest: 2/100", PlayerInfo[i][pBank]);
SendClientMessage(i, COLOR_GREY, string);
format(string, sizeof(string), " New Drugs: %d gram.", PlayerInfo[i][pDrugs]);
SendClientMessage(i, COLOR_GREY, string);
SendClientMessage(i, COLOR_BLUE, "________________________________");
format(string, sizeof(string), "~b~PayDay~n~~w~Paycheck ~n~~g~%d$", PlayerInfo[i][pBank]*2/100);
GameTextForPlayer(i, string, 5000, 1);
UpdatePlayer(i); // Save the stats of the player.
//}
}
If you need something else just let me know. Thanks in advance.
Re: [HELP]Bank interest -
[Aka]Dragonu - 02.09.2011
BUMP!!! ANY HELP PLEASE?
Re: [HELP]Bank interest -
cessil - 03.09.2011
this line here requires a float to store the data or the use of floatround, also the use of more brackets wouldn't hurt.
pawn Код:
PlayerInfo[i][pBank] = PlayerInfo[i][pBank]+PlayerInfo[i][pBank]*2/100;
like this
pawn Код:
PlayerInfo[i][pBank] = floatround(((PlayerInfo[i][pBank] + PlayerInfo[i][pBank] ) * 2 )/100,floatround_round);
now you can see more clearly what's going on.
also on this line, you could just send the message "Bank Interest: 2/100" since you're not using any %'s you're not formatting any number in.
IIRC if you use %%%% then it'll show as a % in game so you could use 2%%%% and in game it'll say 2%
pawn Код:
format(string, sizeof(string), " Bank Interest: 2/100", PlayerInfo[i][pBank]);
Re: [HELP]Bank interest -
[Aka]Dragonu - 03.09.2011
Hey man now instead of increasing my payday interest it deacreases a lot! like from 100k when payday comes my money will be turned to 60k and so on. What can I do further?
Re: [HELP]Bank interest -
[Aka]Dragonu - 03.09.2011
BUMP!!!