23.12.2015, 08:43
The original payday command
The command made by me
What I want to do is the player will get the payday and set him that he got the payday PaydayDa[i] = 1; alright.
And when he type the command, the informations will show /paydaycheck but here is the problem, it don't show the right amounts, at "Salariu" it show 2 or 1 or 0.. and I'm not sure about others.
Код:
public PayDay() { new string[128]; new account,interest; new rent = 0; for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(PlayerInfo[i][pLevel] > 0) { if(Var[MoneyMessage][i]==1) { SendClientMessage(i, COLOR_LIGHTYELLOW, "Nu ti-ai platit datoriile asa ca esti dat in cautare."); GameTextForPlayer(i, "~r~Arestat!", 2000, 1); //Var[WantedLevel][playerid] = 1; //SetPlayerInterior(i, 6); //SetPlayerPos(i, 264.6288,77.5742,1001.0391); //PlayerInfo[i][pJailed] = 1; //ResetPlayerWeapons(i); Var[WantedLevel][i] = 1; //PlayerInfo[i][pJailTime] = 240; //format(string, sizeof(string), "Ai primit wanted %d, pentru ca nu ai platit datoriile.", Var[WantedLevel][i]); SendClientMessage(i, COLOR_LIGHTYELLOW, "Ai primit wanted (1), pentru ca nu ai platit datoriile."); } new playername2[MAX_PLAYER_NAME]; GetPlayerName(i, playername2, sizeof(playername2)); account = PlayerInfo[i][pAccount]; new key = PlayerInfo[i][pPhousekey]; if(key != 255) { rent = HouseInfo[key][hRent]; if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { rent = 0; } else if(rent > GetPlayerMoney(i)) { PlayerInfo[i][pPhousekey] = 255; SendClientMessage(i, COLOR_WHITE, "Ai fost dat afara din casa."); rent = 0; } HouseInfo[key][hMoney] = HouseInfo[key][hMoney]+rent; } new tmpintrate; if (key != 255 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = intrate+4; } else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel] } else { if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = 3; } else { tmpintrate = 1; } } Tax += TaxValue;//Should work for every player online PlayerInfo[i][pAccount] -= TaxValue; if(PlayerInfo[i][pDonateRank] > 0) { new bonus = PlayerInfo[i][pPayCheck] / 2; PlayerInfo[i][pPayCheck] += bonus; } new checks = PlayerInfo[i][pPayCheck]/2; new ebill = (PlayerInfo[i][pAccount]/200000)*(PlayerInfo[i][pLevel]); Var[ConsumingMoney][i] = 1; GivePlayerMoney(i, checks); if(PlayerInfo[i][pAccount] > 0) { PlayerInfo[i][pAccount] -= ebill; SBizzInfo[4][sbTill] += ebill; } else { ebill = 0; } interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate); PlayerInfo[i][pExp]++; PlayerPlayMusic(i); PlayerInfo[i][pAccount] = account+interest; SendClientMessage(i, COLOR_YELLOW, "---------Cont Bancar----------"); SendClientMessage(i, COLOR_LIGHTYELLOW, "SMS de la 521: Buna ziua, contul dumneavoastra bancar a fost actualizat, va asteptam cu un SMS pentru informatii."); SendClientMessage(i, COLOR_YELLOW, "(Tasteaza "COL_WHITE"/paydaycheck "COL_YELLOW"pentru informatii legate de payday.)"); PaydayDa[i] = 1; //format(string, sizeof(string), " Paycheck: $%d Tax Money: -$%d", checks, TaxValue); //SendClientMessage(i, COLOR_WHITE, string); if(PlayerInfo[i][pPhousekey] != 255 || PlayerInfo[i][pPbiskey] != 255) { SendClientMessage(i, COLOR_LIGHTYELLOW, "Facturi"); format(string, sizeof(string), " Factura electricitate: -$%d", ebill); SendClientMessage(i, COLOR_WHITE, string); } //format(string, sizeof(string), " Balance: $%d", account); //SendClientMessage(i, COLOR_WHITE, string); //format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate); //SendClientMessage(i, COLOR_WHITE, string); //format(string, sizeof(string), " Interest Gained $%d", interest); //SendClientMessage(i, COLOR_WHITE, string); //SendClientMessage(i, COLOR_GREEN, "|--------------------------------------|"); //format(string, sizeof(string), " New Balance: $%d", PlayerInfo[i][pAccount]); //SendClientMessage(i, COLOR_WHITE, string); //format(string, sizeof(string), " Rent: -$%d", rent); //SendClientMessage(i, COLOR_WHITE, string); format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck"); GameTextForPlayer(i, string, 5000, 1); rent = 0; RobBankOn = 0; RobBankOn1 = 0; PlayerInfo[i][pRobbed] = 0; PlayerInfo[i][pPayDay] = 0; PlayerInfo[i][pPayCheck] = 0; PlayerInfo[i][pConnectTime] += 1; PlayerInfo[i][pContractTime] += 2; if(PlayerInfo[i][pVip] >= 1) PlayerInfo [i] [pExp] += 1 ; } } } //Checkprop(); return 1; }
Код:
if(strcmp(cmd, "/paydaycheck",true) == 0) { new string[128]; new account, interest; new tmpintrate; new rent = 0; //for(new i = 0; i < MAX_PLAYERS; i++) new key = PlayerInfo[playerid][pPhousekey]; new sendername[MAX_PLAYER_NAME]; GetPlayerName(playerid, sendername, sizeof(sendername)); if (PlayerInfo[playerid][pPhousekey] != 255 && strcmp(sendername, HouseInfo[key][hOwner], true) == 0) { if(PlayerInfo[playerid][pDonateRank] > 0) { tmpintrate = intrate+4; } else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel] } else { if(PlayerInfo[playerid][pDonateRank] > 0) { tmpintrate = 3; } else { tmpintrate = 1; } } if(PaydayDa[playerid] == 1) { new checks = PlayerInfo[playerid][pPayCheck]/2; account = PlayerInfo[playerid][pAccount]; interest = (PlayerInfo[playerid][pAccount]/1000)*(tmpintrate); PlayerInfo[playerid][pAccount] = account+interest; format(string, sizeof(string), " Salariu: $%d | Taxa: -$%d \nRent: -%d \nRata Interes Bancar: 0.%d | Interes Bancar: %d\n\n\n Balanta Veche\n %d \n\n\n Balanta Noua: %d", checks, TaxValue, rent, tmpintrate, interest, account, PlayerInfo[playerid][pAccount]); ShowPlayerDialog(playerid, DIALOG_PAYDAY, DIALOG_STYLE_MSGBOX, "PAYDAY", string, "OK", "Inchide"); } else return SendClientMessage(playerid, COLOR_WHITE, "Nu ai primit payday-ul inca."); return 1; }
And when he type the command, the informations will show /paydaycheck but here is the problem, it don't show the right amounts, at "Salariu" it show 2 or 1 or 0.. and I'm not sure about others.