03.12.2009, 13:40
This is my pay day code preaty much easy scripting but it wont work proply IE:-
it doesnt pay at all sometimes
when it does pay it pays everyone the amount of times there are players
at this point i need to say that i have ten NPC's on my sever so the payday pays 11 times thats once per NPC and one for the player
anyway here is my code
this is the trigger for the paydays
this is the payday code if you need to see anymore of the code that i have missed or forgot about please ask and i will do my best to find it
hope someone can help as this is one of the last bugs to fix on my server thanks
it doesnt pay at all sometimes
when it does pay it pays everyone the amount of times there are players
at this point i need to say that i have ten NPC's on my sever so the payday pays 11 times thats once per NPC and one for the player
anyway here is my code
Код:
public ScoreUpdate() { new Score; new name[MAX_PLAYER_NAME]; for(new i=0; i<MAX_PLAYERS; i++) { if (IsPlayerConnected(i)) { medd(); RankUpdate(i); new tmpminute; gettime(tmpminute); if(tmpminute == 0)// && tmpsecond == 0) if(PayDayhad[i] == 0) PayDay(); GetPlayerName(i, name, sizeof(name)); Score = AccountInfo[i][aScore]; SetPlayerScore(i, Score); if (Score > ScoreOld) { ScoreOld = Score; } } } }
Код:
public PayDay() { for(new i = 0; i < MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { if(AccountInfo[i][aLogged] == 1) { new wstring[128]; new payday = BasePay*AccountInfo[i][aScore]; new intrate = 1*AccountInfo[i][aScore]; new interest = (payday)*(intrate); new newbank = AccountInfo[i][aBank] + interest; new randtax = 20 + random(50); new Gtax = payday/randtax; SendClientMessage(i,COLOR_RED,"|_____________Bank_of_San_Andreas______________|"); SendClientMessage(i,COLOR_GREEN,"|___________________PaySlip____________________|"); format(wstring, sizeof(wstring), "~y~PayDay~n~~w~Paycheck: ~g~%d",payday); GameTextForPlayer(i, wstring, 5000, 1); format(wstring, sizeof(wstring), "PayCheck: $%d", payday); SendClientMessage(i,COLOR_WHITE, wstring); format(wstring, sizeof(wstring), "Old Balance: $%d | New Balance: $%d", AccountInfo[i][aBank], newbank); SendClientMessage(i,COLOR_WHITE, wstring); format(wstring, sizeof(wstring), "Interest Gained: $%d | Interest Rate: 0.%d percent", interest, intrate); SendClientMessage(i,COLOR_WHITE, wstring); format(wstring, sizeof(wstring), "Government Taxes: $%d", Gtax); SendClientMessage(i,COLOR_WHITE, wstring); AccountInfo[i][aBank] += interest; AccountInfo[i][aBank] -= Gtax; AccountInfo[i][aBank] += payday; AccountInfo[i][aXP]++; PayDayhad[i] = 1; SendClientMessage(i,COLOR_GREEN,"|______________________________________________|"); print("PayDay"); VehicleReset(); if(GetPlayerTotalMoney(i) >= PayCutoff) { SendClientMessage(i,COLOR_WHITE,"Government: You are to rich dont expect a Giro this time"); } else { format(wstring, sizeof(wstring), "Government: Sorry You Cannot Earn A Payday (not logged in)"); SendClientMessage(i,COLOR_WHITE, wstring); } } else { SendClientMessage(i,COLOR_WHITE,"Government: Sorry You Cannot Earn A Payday (not logged in)"); } } } return 0; }
hope someone can help as this is one of the last bugs to fix on my server thanks