05.03.2014, 20:12
Hi !
I have a problem with my PayDay function : it seems to be a random bug. Sometimes, the payday is given to each player on my server. Sometimes, only certain player earn their payday (I think it depends on the ID, and how many players is connected). For the players who don't have the payday, I don't see "TEST1" and "TEST2".
Here is the code :
Where is the bug ?
Thank for the help
I have a problem with my PayDay function : it seems to be a random bug. Sometimes, the payday is given to each player on my server. Sometimes, only certain player earn their payday (I think it depends on the ID, and how many players is connected). For the players who don't have the payday, I don't see "TEST1" and "TEST2".
Here is the code :
Код:
public PayDay() { new string[128]; new account,interest; new rent = 0; new sendername[MAX_PLAYER_NAME]; for(new i = 0; i < MAX_PLAYERS; i++) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, sizeof(string), "%s TEST 1 Payday !", sendername); SendClientMessageToAll(COLOR_LIGHTRED, string); if(IsPlayerConnected(i)) { GetPlayerName(i, sendername, sizeof(sendername)); format(string, sizeof(string), "%s TEST2 Payday !", sendername); SendClientMessageToAll(COLOR_LIGHTRED, string); if(PlayerInfo[i][pLevel] > 0) { if(MoneyMessage[i]==1) { SendClientMessage(i, COLOR_LIGHTRED, "Vous n'avez pas payй vos dettes, vous allez en prison."); GameTextForPlayer(i, "~r~en prison !", 2000, 1); SetPlayerInterior(i, 6); PlayerInfo[i][pInt] = 6; SetPlayerPos(i, -357.9031,1883.6422,603.1583); FreezeTele(i); SetTimerEx("DeFreezeTele", 1500, false, "i", i); PlayerInfo[i][pJailed] = 1; SafeResetPlayerWeapons(i); SafeResetPlayerMoney(i); WantedPoints[i] = 0; PlayerInfo[i][pJailTime] = 240; format(string, sizeof(string), "Vous allez en prison pendant %d secondes. Caution : autorisйe", PlayerInfo[i][pJailTime]); SendClientMessage(i, COLOR_WHITE, string); } 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, "Vous avez йtй expulsй."); rent = 0; } HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent; } new tmpintrate; if (key != 255 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0) { if(PlayerInfo[i][pVIPRank] > 0) { tmpintrate = intrate+4; } else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel] } else { if(PlayerInfo[i][pVIPRank] > 0) { tmpintrate = 3; } else { tmpintrate = 1; } } if(PlayerInfo[i][pPayDay] >= 5) { Tax += TaxValue;//Should work for every player online PlayerInfo[i][pAccount] -= TaxValue; new checks = PlayerInfo[i][pPayCheck] / 5; if(PlayerInfo[i][pVIPRank] > 0) { new bonus = PlayerInfo[i][pPayCheck] / 10; checks += bonus; } new ebill = (PlayerInfo[i][pAccount]/10000)*(PlayerInfo[i][pLevel]); //ConsumingMoney[i] = 1; //SafeGivePlayerMoney(i, checks); account += checks; if(PlayerInfo[i][pAccount] > 0) { PlayerInfo[i][pAccount] -= ebill; SBizzInfo[4][sbTill] += ebill; } else { ebill = 0; } interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate); if(PlayerInfo[i][pLevel] >= 10) { PlayerInfo[i][pExp] += 1; } else { PlayerInfo[i][pExp] += 2; } PlayerPlayMusic(i); PlayerInfo[i][pAccount] = account+interest; SendClientMessage(i, COLOR_GREEN, "|___ ETAT DE VOTRE COMPTE ___|"); format(string, sizeof(string), " Salaire : %d $ Taxe : -%d $", checks, TaxValue); SendClientMessage(i, COLOR_WHITE, string); if(PlayerInfo[i][pPhousekey] != 255 || PlayerInfo[i][pPbiskey] != 255) { format(string, sizeof(string), " Facture d'йlectricitй : -%d $", ebill); SendClientMessage(i, COLOR_GRAD1, string); } format(string, sizeof(string), " Balance: %d $", account - checks); SendClientMessage(i, COLOR_WHITE, string); format(string, sizeof(string), " Taux d'intйrкt: 0.%d pourcent",tmpintrate); SendClientMessage(i, COLOR_GRAD2, string); format(string, sizeof(string), " Intйrкts perзus: %d $", interest); SendClientMessage(i, COLOR_GRAD3, string); SendClientMessage(i, COLOR_GREEN, "|--------------------------------------|"); format(string, sizeof(string), " Nouvelle balance : %d $", PlayerInfo[i][pAccount]); SendClientMessage(i, COLOR_GRAD5, string); format(string, sizeof(string), " Location: -%d $", rent); SendClientMessage(i, COLOR_GRAD5, string); format(string, sizeof(string), "~y~Salaire~n~~w~Argent mis directement sur votre compte"); GameTextForPlayer(i, string, 5000, 1); rent = 0; PlayerInfo[i][pPayDay] = 0; PlayerInfo[i][pPayCheck] = 0; PlayerInfo[i][pConnectTime] += 3; if(FarmerVar[i] == 0) { FarmerPickup[i][0] = 0; } if(DrugFarmerVar[i] == 0) { DrugFarmerPickup[i][0] = 0; } if(SmugglerWork[i] == 0) { PayDaySecure[i] = 0; } if(PlayerInfo[i][pVIPRank] > 0) { PlayerInfo[i][pPayDayHad] += 1; if(PlayerInfo[i][pPayDayHad] >= 5) { PlayerInfo[i][pExp]++; PlayerInfo[i][pPayDayHad] = 0; } } new nxtlevel = PlayerInfo[i][pLevel]+1; new expamount = nxtlevel*levelexp; new infostring[256]; if (PlayerInfo[i][pExp] >= expamount) { format(string, sizeof(string), "~g~Niveau Supйrieur~n~~w~ Vous кtes maintenant niveau %d !", nxtlevel); PlayerPlaySound(i, 1052, 0.0, 0.0, 0.0); PlayerPlayMusic(i); PlayerInfo[i][pLevel]++; if(PlayerInfo[i][pVIPRank] > 0) { PlayerInfo[i][pExp] -= expamount; new total = PlayerInfo[i][pExp]; if(total > 0) { PlayerInfo[i][pExp] = total; } else { PlayerInfo[i][pExp] = 0; } } else { PlayerInfo[i][pExp] = 0; } PlayerInfo[i][gPupgrade] = PlayerInfo[i][gPupgrade]+2; GameTextForPlayer(i, string, 5000, 1); format(infostring, 256, "Vous кtes au niveau %d. Faites /upgrade", nxtlevel); SendClientMessage(i, COLOR_GRAD1, infostring); format(infostring, 256, "Vous avez %d points d'upgrade а utiliser.",PlayerInfo[i][gPupgrade]); SendClientMessage(i, COLOR_GRAD2, infostring); } } else { SendClientMessage(i, COLOR_WHITE, "* Vous n'avez pas assez jouй pour toucher votre salaire."); } } } } SaveAccounts(); Checkprop(); return 1; }
Thank for the help