Payday Crashing
#1

Hey guys, I ran into a problem while editing a gamemode. Its a Godfather script and when ever payday comes everyone seems to crash. I really need a fix for this problem. This is what my public Payday(); looks like:

Код:
public PayDay()
{
	new string[128];
	new account,interest;
	new rent = 0;
	GiftAllowed = 1;
 	foreach(Player, i)
	{
			if(PlayerInfo[i][pLevel] > 0)
			{
				if(MoneyMessage[i]==1)
				{
				    if( PlayerInfo[i][pJailed] < 1 && !IsACop(i))
				    {
				        format(string,sizeof(string),"You're failing to pay your debt of $%d - now the police are on the look out for you.",GetPlayerCash(i));
						SendClientMessageEx(i, COLOR_LIGHTRED, string);
						if(PlayerInfo[i][pWantedLevel] < 6) PlayerInfo[i][pWantedLevel] += 1;
						PlayerInfo[i][pCrimes] += 1;
						SetPlayerWantedLevel(i, PlayerInfo[i][pWantedLevel]);
					}
				}
				account = PlayerInfo[i][pAccount];
				if(PlayerInfo[i][pRenting] != INVALID_HOUSE_ID)
				{
					if(HouseInfo[PlayerInfo[i][pRenting]][hRentFee] > PlayerInfo[i][pAccount])
					{
						PlayerInfo[i][pRenting] = INVALID_HOUSE_ID;
						SendClientMessageEx(i, COLOR_WHITE, "You have been evicted.");
					}
					else {
						HouseInfo[PlayerInfo[i][pRenting]][hSafeMoney] += HouseInfo[PlayerInfo[i][pRenting]][hRentFee];
						PlayerInfo[i][pAccount] -= HouseInfo[PlayerInfo[i][pRenting]][hRentFee];
					}
				}
				new tmpintrate, faretax;
				tmpintrate = 1;

				// REMOVED FOR INTEREST RATE/ELECTRICITY BILL FIX
				/*if (PlayerInfo[i][pPhousekey] != INVALID_HOUSE_ID || PlayerInfo[i][pPhousekey2] != INVALID_HOUSE_ID)
				{
					if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = intrate+2; }
					else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel]
				}
				else
				{
					if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = 2; }
					else { tmpintrate = 1; }
				}*/


				if(PlayerInfo[i][pLevel] <= 5) SendClientMessageEx(i,COLOR_LIGHTBLUE,"Need to travel somewhere and don't have wheels? Use '/service taxi' to call a cab!");
				if(PlayerInfo[i][pPayDay] >= 5)
				{
                    if(GetPVarInt(i, "AdvisorDuty") == 1)
					{
	    				PlayerInfo[i][pDutyHours]++;
					}
					if(PlayerInfo[i][pDonateRank] > 0)
					{
						new bonus = PlayerInfo[i][pPayCheck] / 2;
						PlayerInfo[i][pPayCheck] += bonus;
					}
					if(SpecTimer == 1)
					{
						AddSpecialToken(i);
					}
					rent = 0;
					faretax = 0;
					new checks = PlayerInfo[i][pPayCheck];
					if(PlayerInfo[i][pTaxiLicense] == 1) faretax = (checks/100)*5;
					new Taxable = (( checks / 100 ) * TaxValue);
					PlayerInfo[i][pAccount] -= Taxable + faretax;
					Tax += Taxable + faretax;

					interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);

					if(PlayerInfo[i][pDonateRank] == 0 && interest > 500)
					{
						interest = 50000;
					}
					else if(PlayerInfo[i][pDonateRank] == 1 && interest > 1000)
					{
						interest = 100000;
					}
					else if(PlayerInfo[i][pDonateRank] == 2 && interest > 1500)
					{
						interest = 150000;
					}
					else if(PlayerInfo[i][pDonateRank] == 3 && interest > 2000)
					{
						interest = 200000;
					}
					else if(PlayerInfo[i][pDonateRank] >= 4 && interest > 2500)
					{
						interest = 250000;
					}


					PlayerInfo[i][pExp]++;
					PlayerInfo[i][pAccount] = account+interest;
					SendClientMessageEx(i, COLOR_WHITE, "________ BANK STATEMENT ________");
					format(string, sizeof(string), "  Paycheck: $%d  |  Tax Money: -$%d (%d percent)", checks, Taxable, TaxValue);
					SendClientMessageEx(i, COLOR_GRAD1, string);

					if(PlayerInfo[i][pDonateRank] == 0)
					{
						format(string, sizeof(string), "  Balance: $%d  |  Interest rate: 0.%d percent (50k max)", account, tmpintrate);
						SendClientMessageEx(i, COLOR_GRAD1, string);
					}
					else if(PlayerInfo[i][pDonateRank] == 1)
					{
						format(string, sizeof(string), "  Balance: $%d  |  Interest rate: 0.%d percent {FFFF00}(Bronze VIP: 100k max)", account, tmpintrate);
						SendClientMessageEx(i, COLOR_GRAD1, string);
					}
					else if(PlayerInfo[i][pDonateRank] == 2)
					{
						format(string, sizeof(string), "  Balance: $%d  |  Interest rate: 0.%d percent {FFFF00}(Silver VIP: 150k max)", account, tmpintrate);
						SendClientMessageEx(i, COLOR_GRAD1, string);
					}
					else if(PlayerInfo[i][pDonateRank] == 3)
					{
						format(string, sizeof(string), "  Balance: $%d  |  Interest rate: 0.%d percent {FFFF00}(Gold VIP: 200k max)", account, tmpintrate);
						SendClientMessageEx(i, COLOR_GRAD1, string);
					}
					else if(PlayerInfo[i][pDonateRank] >= 4)
					{
						format(string, sizeof(string), "  Balance: $%d  |  Interest rate: 0.%d percent {FFFF00}(Platinum VIP: 250k max)", account, tmpintrate);
						SendClientMessageEx(i, COLOR_GRAD1, string);
					}
					else if(PlayerInfo[i][pDonateRank] >= 5)
					{
						format(string, sizeof(string), "  Balance: $%d  |  Interest rate: 0.%d percent {FFFF00}(VIP Moderator: 250k max)", account, tmpintrate);
						SendClientMessageEx(i, COLOR_GRAD1, string);
					}

					if(PlayerInfo[i][pTaxiLicense] == 1)
					{
						format(string, sizeof(string), "  Taxi licensing fee (5 percent): -$%d",faretax);
						SendClientMessageEx(i, COLOR_GRAD2, string);
					}
					if(PlayerInfo[i][pMember] != 0 && PlayerInfo[i][pMember] != 8 && PlayerInfo[i][pMember] != 13)
					{
					    if(Tax <= 0)
						{
							SendClientMessageEx(i,COLOR_RED,"The government is in debt; no money is available for pay.");
						}
						else
						{
							Tax -= FactionPay[PlayerInfo[i][pMember]-1][PlayerInfo[i][pRank]];
							format(string,sizeof(string),"  Government pay: $%d", FactionPay[PlayerInfo[i][pMember]-1][PlayerInfo[i][pRank]]);
					    	SendClientMessageEx(i, COLOR_GRAD2, string);
						}
					}
					format(string, sizeof(string), "  Interest gained: $%d", interest);
					SendClientMessageEx(i, COLOR_GRAD3, string);
					SendClientMessageEx(i, COLOR_GRAD4, "______________________________________");
					format(string, sizeof(string), "  New balance: $%d  |  Rent paid: -$%d", PlayerInfo[i][pAccount],rent);
					SendClientMessageEx(i, COLOR_GRAD5, string);

					// Removal of hourly tokens
			  		if(PlayerInfo[i][pDonateRank] == 2)
			    	{
						PlayerInfo[i][pTokens] += 3;
						SendClientMessageEx(i, COLOR_YELLOW, "VIP: You have received 3 tokens.");
					}
					if(PlayerInfo[i][pDonateRank] == 1)
			    	{
						PlayerInfo[i][pTokens] += 2;
						SendClientMessageEx(i, COLOR_YELLOW, "VIP: You have received 2 tokens.");
					}

					new paycheck = checks - Taxable - faretax;
					if(PlayerInfo[i][pMember] != 0 && PlayerInfo[i][pMember] != 8 && PlayerInfo[i][pMember] != 13 && Tax >= 0)
					{
						new facmemberpay = FactionPay[PlayerInfo[i][pMember]-1][PlayerInfo[i][pRank]];
						GivePlayerCash(i, facmemberpay);
					}
					GivePlayerCash(i, paycheck);

					GameTextForPlayer(i, "~y~PayDay~n~~w~Paycheck", 5000, 1);
					SendAudioToPlayer(i, 1184, 100, 0);
					PlayerInfo[i][pPayDay] = 0;
					PlayerInfo[i][pPayCheck] = 0;
					PlayerInfo[i][pConnectTime] += 1;
					PlayerInfo[i][pExp] += 1;
					//if(PlayerInfo[i][pConnectTime] == 2) SendClientMessageEx(i, COLOR_LIGHTRED, "You may now possess/use weapons!");
					if(PlayerInfo[i][pDonateRank] > 0)
					{
						PlayerInfo[i][pPayDayHad] += 1;
						if(PlayerInfo[i][pPayDayHad] >= 5)
						{
							PlayerInfo[i][pPayDayHad] = 0;
						}
					}
					if(PlayerInfo[i][pWRestricted] > 0)
					{
					    PlayerInfo[i][pWRestricted]--;
						if(PlayerInfo[i][pWRestricted] == 0) SendClientMessageEx(i, COLOR_LIGHTRED, "Your weapons are no longer restricted!");
					}

				}
				else
				{
					SendClientMessageEx(i, COLOR_LIGHTRED, "* You haven't played long enough to obtain a paycheck.");
				}
			}
	}
	for (new x=0; x<MAX_POINTS; x++)
	{
		Points[x][Announced] = 0;
		if (Points[x][Vulnerable] > 0)
		{
			Points[x][Vulnerable]--;
			UpdatePoints();
		}
		if(Points[x][Vulnerable] == 0 && Points[x][Announced] == 1)
		{
		}
		if (Points[x][Vulnerable] == 0 && Points[x][Type] >= 0 && Points[x][Announced] == 0 && Points[x][ClaimerId] == INVALID_PLAYER_ID)
		{
			format(string, sizeof(string), "%s has become available for capture.", Points[x][Name]);
			//SendClientMessageToAllEx(COLOR_YELLOW, string); - Commented by Voltage
			//SetPlayerCheckpoint(i, Points[i][Pointx], Points[i][Pointy], Points[i][Pointz], 3);
			ReadyToCapture(x);
			Points[x][Announced] = 1;
		}
	}
	SaveStuff();
	SaveServerStats();
	FMemberCounter(); // Family member counter (requested by game affairs to track gang activity)
	return 1;
}
And this is what the Server_Logs gives me

Код:
[02:07:34] [debug] Server crashed while executing TEST.amx
[02:07:34] [debug] AMX backtrace:
[02:07:34] [debug] #0 native fwrite () [00405710] from samp-server.exe
[02:07:34] [debug] #1 00069168 in ?? (0x00000000) from TEST.amx
[02:07:34] [debug] #2 00165ee0 in public PayDay () from TEST.amx
[02:07:34] [debug] #3 0027e8a8 in public cmd_payday (0x00000003, 0x01f1974c) from TEST.amx
[02:07:34] [debug] #4 native CallLocalFunction () [00471e90] from samp-server.exe
[02:07:34] [debug] #5 0000b034 in public OnPlayerCommandText (0x00000003, 0x01f1972c) from TEST.amx
[02:07:34] [debug] Native backtrace:
Looking for fast answers, Thanks.
Reply


Messages In This Thread
Payday Crashing - by iPlaySAMPalot - 25.01.2014, 01:42
Re: Payday Crashing - by kaisersouse - 25.01.2014, 16:08
Re: Payday Crashing - by iPlaySAMPalot - 25.01.2014, 16:23
Re: Payday Crashing - by kaisersouse - 25.01.2014, 16:45
Re: Payday Crashing - by Konstantinos - 25.01.2014, 16:53
Re: Payday Crashing - by iPlaySAMPalot - 25.01.2014, 17:19
Re: Payday Crashing - by Shawn912 - 25.01.2014, 18:39
Re: Payday Crashing - by kaisersouse - 25.01.2014, 19:08
Re: Payday Crashing - by Shawn912 - 25.01.2014, 19:13

Forum Jump:


Users browsing this thread: 1 Guest(s)