Jump to content
  • 0

Problema PayDay


RICK

Question

Salut Sa-Mp.Ro,

Problema intalnita (descriere): Am o problema la PayDay, la fix nu se primeste payday, nu se afiseaza niciun mesaj, desii acestea exista.
Ero(area / rile) / warning-(ul / urile): -
Liniile de cod / sursa / script-ul(obligatoriu):

Public PayDay

public PayDay()
{
	new string[128],
		str[256],
		string3[128],
		interest,
		account[MAX_PLAYERS],
		hour,
		minn,
		sec,
		expamount,
		rent[MAX_PLAYERS];
	gettime(hour,minn,sec);
	foreach(Player,i)
	{
		if(IsPlayerConnected(i))
		{
		    if(PlayerInfo[i][pLevel] >= 0)
		    {
            	new wakaname[25];
                GetPlayerName(i,wakaname,sizeof(wakaname));
			    if(MoneyMessage[i]==1)
				{
				    SendClientMessage(i, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
                    new rand;
					rand = random(sizeof(gRandomJailSpawns));
					SetPlayerInterior(i, 6);
					SetPlayerPos(i,gRandomJailSpawns[rand][0],gRandomJailSpawns[rand][1],gRandomJailSpawns[rand][2]);
		            PlayerInfo[i][pJailed] = 1;
		            ResetPlayerWeaponsEx(i);
		            ResetPlayerWeapons(i);
					WantedPoints[i] = 0;
					PlayerInfo[i][pJailTime] = 240;
					format(string, sizeof(string), "You are jailed for %d seconds.   Bail: Unable", PlayerInfo[i][pJailTime]);
					SendClientMessage(i, COLOR_LIGHTBLUE, string);
					Update(i,pJailedx);
					Update(i,pJailTimex);
					TogglePlayerControllable(i, 0);
					SetTimerEx("UnFreezeStation", 1000, false, "i", i);
				}
				new playername2[MAX_PLAYER_NAME];
				GetPlayerName(i, playername2, sizeof(playername2));
				new key = PlayerInfo[i][pPhousekey];
				if(key != 999)
				{
					rent[i] = HouseInfo[key][hRent];
					if(rent[i] > GetPlayerCash(i) && strcmp(playername2, HouseInfo[key][hOwner], false) == 0)
					{
						PlayerInfo[i][pPhousekey] = 999;
						Update(i,pPhousekeyx);
					}
					HouseInfo[key][hTakings] += rent[i];
				    mysql_format(SQL,str,sizeof(str),"UPDATE `houses` SET `Takings`='%d' WHERE `ID`='%d'",HouseInfo[key][hTakings],key);
				    mysql_tquery(SQL,str,"","");
				}
				if(PlayerInfo[i][pPayDay] >= 5)
				{
					new tmpintrate;
					if(PlayerInfo[i][pPremiumAccount] == 1)
					{
						tmpintrate = 2;
					    PlayerInfo[i][pPayDayHad] += 1;
					    if(PlayerInfo[i][pPayDayHad] >= 5)
					    {
					        PlayerInfo[i][pExp]++;
					        PlayerInfo[i][pPayDayHad] = 0;
					        SCM(i,COLOR_LIGHTBLUE,"You got 1 respect point bonus because you have premium account.");
					    }
					    new bonus = PlayerInfo[i][pPayCheck] / 2;
					    PlayerInfo[i][pPayCheck] += bonus;
					}
					else
					{
						tmpintrate = 1;
					}
					account[i] = PlayerInfo[i][pAccount];
					Tax += TaxValue;
				    PlayerInfo[i][pAccount] -= TaxValue;
					new checks = PlayerInfo[i][pPayCheck],
				    	ebill = (PlayerInfo[i][pLevel]*SBizzInfo[14][sbEntranceCost]/100);
				    PlayerInfo[i][pAccount] += checks;
					interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);
					PlayerInfo[i][pExp] += 1;
					PlayerInfo[i][pAccount] += interest;
					SendClientMessage(i, COLOR_TEAL, "----------------------------------------------------------------------------");
					SendClientMessage(i, COLOR_WHITE, "Your paycheck has arrived; please visit the bank to withdraw your money.");
					format(string, sizeof(string), "Paycheck: $%s | Bank balance: $%s | Bank interest: $%s | Tax: $%s (10 percent)", FormatNumber(checks), FormatNumber(PlayerInfo[i][pAccount]), FormatNumber(interest), FormatNumber(TaxValue));
					SendClientMessage(i, COLOR_GREY, string);
					format(string3, sizeof(string3), "Rent: $%s | Total earnings: $%d", FormatNumber(rent[i]), checks-TaxValue);
					SendClientMessage(i, COLOR_GREY, string3);
					SendClientMessage(i, COLOR_TEAL, "----------------------------------------------------------------------------");
					if(PlayerInfo[i][pAccount] >= ebill && key != 999 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
					{
				    	PlayerInfo[i][pAccount] -= ebill;
				    	SBizzInfo[14][sbTill] += ebill;
				    	mysql_format(SQL,str,sizeof(str),"UPDATE `sbizz` SET `Till`='%d' WHERE `ID`='14'",SBizzInfo[14][sbTill]);
						mysql_tquery(SQL,str,"","");
					}
					else
					{
					    ebill = 0;
					}
					format(string, sizeof(string), "~y~payday");
					GameTextForPlayer(i, string, 5000, 1);
					PlayerInfo[i][pPayDay] = 0;
					PlayerInfo[i][pPayCheck] = 0;
					if(PlayerInfo[i][pCarLicT] > 0)
					{
						PlayerInfo[i][pCarLicT] -= 1;
					}
					if(PlayerInfo[i][pFlyLicT] > 0)
					{
						PlayerInfo[i][pFlyLicT] -= 1;
					}
					if(PlayerInfo[i][pBoatLicT] > 0)
					{
						PlayerInfo[i][pBoatLicT] -= 1;
					}
    				if(PlayerInfo[i][pGunLicT] > 0)
					{
						PlayerInfo[i][pGunLicT] -= 1;
					}
					if(PlayerInfo[i][pRob] < 10)
	                {
                        PlayerInfo[i][pRob]++;
	                }
	 				if(PlayerInfo[i][pFpunish] > 0)
	 				{
						PlayerInfo[i][pFpunish]--;
			 		}
					if(PlayerInfo[i][pSleeping] == 0)
					{
                	    PlayerInfo[i][pConnectTime] += 1;
                	}
                	if(IsACop(i))
					{
                	    PlayerInfo[i][pLawyer] += 1;
                	}
					if(PlayerInfo[i][pLevel] == 1 || PlayerInfo[i][pLevel] == 2 || PlayerInfo[i][pLevel] == 3 || PlayerInfo[i][pLevel] == 4)
					{
					    expamount = PlayerInfo[i][pLevel]*2;
						if(PlayerInfo[i][pExp] >= expamount)
						{
						    SCM(i,COLOR_LIGHTBLUE,"** You can use buylevel because you have necessary respect points.");
						}
					}
					else if(PlayerInfo[i][pLevel] >= 5)
					{
					    expamount = PlayerInfo[i][pLevel]*3;
						if(PlayerInfo[i][pExp] >= expamount)
						{
						    SCM(i,COLOR_LIGHTBLUE,"** You can use buylevel because you have necessary respect points.");
						}
					}
				}
				else
				{
					SendClientMessage(i, COLOR_LIGHTRED, "* You haven't played long enough to obtain a PayDay.");
				}
			}
		}
	}
	for(new x = 0; x < MAX_GROUPS; x++)
	{
	    DynamicFactions[x][fBank] += DynamicFactions[x][fPaydayMoney];
	    mysql_format(SQL,str,sizeof(str),"UPDATE `factions` SET `Bank`='%d' WHERE `ID`='%d'",DynamicFactions[x][fBank],x);
		mysql_tquery(SQL,str,"","");
	}
	return 1;
}

Public SyncUp

synctimer = SetTimer("SyncUp", 60000, 1);

public SyncUp()
{
	new string[128],
		tmphour,
		tmpminute,
		tmpsecond,
		hour,
		minn,
		sec;
	gettime(hour,minn,sec);
	gettime(tmphour, tmpminute, tmpsecond);
	FixHour(tmphour);
	tmphour = shifthour;
	if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
	{
		format(string, sizeof(string), "SERVER: The time is now %d:00 hours",hour);
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		if(hour == 20 || hour == 10 || hour == 22)
		{
			format(string, sizeof(string), "Lottery News: We have started the Lottery Election.");
		    OOCOff(COLOR_WHITE, string);
		    new rand = random(80);
		    if(rand < 77) { rand += 3; }
		    Lotto(rand);
	    }
	    if(hour == 22)
	    {
        	mysql_tquery(SQL,"UPDATE users SET FactionTime = FactionTime+1 WHERE Member > 0","","");
        	foreach(Player, i)
        	{
				new escstr2[MAX_PLAYER_NAME],
					result[500],
					query[500];
				GetPlayerName(i, escstr2, sizeof(escstr2));
            	format(query, sizeof(query), "SELECT `FactionTime` FROM users WHERE `name` = '%s'", escstr2);
            	mysql_store_result();
				mysql_query(SQL,query);
				if(mysql_retrieve_row())
      			{
					mysql_fetch_field_row(result, "FactionTime"); PlayerInfo[i][pFactionTime] = strval( result );
				}
				mysql_free_result();
			}
		}
		if(hour == 23)
		{
			new str[256];
		    for(new turf = 1; turf < sizeof(TurfInfo); turf++)
		    {
				TurfInfo[turf][zTime] = 0;
				mysql_format(SQL,str,sizeof(str),"UPDATE `turfs` SET `Time`='0' WHERE `ID`='%d'",turf);
				mysql_tquery(SQL,str,"","");
		    }
		}
		if (realtime)
		{
			SetWorldTime(hour);
		}
	}
	return 1;
}


Imagini / Video (optional): -
Ati incercat sa rezolvati singur?: Da, dar nu i-am dat de cap.

 

Multumesc mult.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Problema ta este cauzata din cauza SyncUp, dar si timer-ul ar trebui ajustat.:

synctimer = SetTimer("SyncUp", 1000, 1);

Asa va verifica odata la o secunda, iar in SyncUP trebuie modificata verificarea pentru a primi la ora fixa payday

 

public SyncUp()
{
	new string[128],
		tmphour,
		tmpminute,
		tmpsecond,
		hour,
		minn,
		sec;
	gettime(hour,minn,sec);
	gettime(tmphour, tmpminute, tmpsecond);
	FixHour(tmphour);
	tmphour = shifthour;
	if (minn == 0 && sec == 0)
	{
		format(string, sizeof(string), "SERVER: The time is now %d:00 hours",hour);
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		if(hour == 20 || hour == 10 || hour == 22)
		{
			format(string, sizeof(string), "Lottery News: We have started the Lottery Election.");
		    OOCOff(COLOR_WHITE, string);
		    new rand = random(80);
		    if(rand < 77) { rand += 3; }
		    Lotto(rand);
	    }
	    if(hour == 22)
	    {
        	mysql_tquery(SQL,"UPDATE users SET FactionTime = FactionTime+1 WHERE Member > 0","","");
        	foreach(Player, i)
        	{
				new escstr2[MAX_PLAYER_NAME],
					result[500],
					query[500];
				GetPlayerName(i, escstr2, sizeof(escstr2));
            	format(query, sizeof(query), "SELECT `FactionTime` FROM users WHERE `name` = '%s'", escstr2);
            	mysql_store_result();
				mysql_query(SQL,query);
				if(mysql_retrieve_row())
      			{
					mysql_fetch_field_row(result, "FactionTime"); PlayerInfo[i][pFactionTime] = strval( result );
				}
				mysql_free_result();
			}
		}
		if(hour == 23)
		{
			new str[256];
		    for(new turf = 1; turf < sizeof(TurfInfo); turf++)
		    {
				TurfInfo[turf][zTime] = 0;
				mysql_format(SQL,str,sizeof(str),"UPDATE `turfs` SET `Time`='0' WHERE `ID`='%d'",turf);
				mysql_tquery(SQL,str,"","");
		    }
		}
		if (realtime)
		{
			SetWorldTime(hour);
		}
	}
	return 1;
}

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.