Jump to content
  • 0

Problema nu se salveaza rob points la payday.


SpriteTV

Question

Salut am si eu problema urmatoare nu mi-se salveaza rob points-ul si nu inteleg care ar fi problema daca se poate sa ma ajute cineva.

public PayDay()
{
	new string[128],
		str[256],
		string3[256],
		interest,
		account[MAX_PLAYERS],
		hour,
		minn,
		sec,
		ye,
		mo,
		da,
		rent[MAX_PLAYERS],
		hourscount;
	gettime(hour,minn,sec);
	getdate(ye, mo, da);
	if(RestartTimer == 1)
	{
		SendClientMessageToAll(COLOR_YELLOW, "---- SERVER RESTART ----");
		SendClientMessageToAll(COLOR_RED2, "The server will be restarted in 60 seconds.");
		foreach(new x : Player)
		{
			Update(x, pPayDayx);
			Update(x, pPayCheckx);
			Update(x, pFpunishx);
			Update(x, pConnectTimex);
			Update(x, pBank);
			Update(x, pCashx);
			Update(x, pExpx);
			Update(x, pJailTimex);
			Update(x, pLevelx);
			Update(x, pRob);
		}
		iGMXTick = 60;
		iGMXTimer = SetTimer("restartTimer", 1000, true);
		RestartTimer = 0;
	}
	foreach(new i : Player)
	{
		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);
					SetPlayerPosEx(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);
					ResetPlayerCash(i);
					GivePlayerCash(i, 10000);
					Update(i, pCashx);
					Update(i,pJailedx);
					Update(i,pJailTimex);
					TogglePlayerControllable(i, 0);
					SetTimerEx("UnFreezeStation", 1000, false, "i", i);
				}
				new key = PlayerInfo[i][pPhousekey];
				if(key != 999)
				{
					rent[i] = HouseInfo[key][hRent];
					if(rent[i] > GetPlayerCash(i) && strcmp(PlayerInfo[i][pNormalName], 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,"","");
				}
				new tmpintrate;
				if(PlayerInfo[i][pPremiumAccount] > 0)
				{
					tmpintrate = 2;
	    			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];
    			PlayerInfo[i][pAccount] += checks;
				interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);
				new finalinterest,stringore[128];
				new Float:timee,Float:timee2;
				SendClientMessage(i, COLOR_TEAL, "----------------------------------------------------------------------------");
				SendClientMessage(i, COLOR_WHITE, "Your paycheck has arrived; please visit the bank to withdraw your money.");
				PlayerInfo[i][pConnectTime] += PlayerInfo[i][pPayDay] / 3600.0;
				timee = PlayerInfo[i][pPayDay] / 3600.0;
				timee2 = PlayerInfo[i][pPayDay] / 60.0;
				finalinterest = interest;
				if(PlayerInfo[i][pPayDay] > 1801)
				{
					PlayerInfo[i][pGiftTime] += 40;
					Update(i, pGiftTimex);
					SS(i,COLOR_LIGHTBLUE, "Ai primit 40 gift points pentru ca ai jucat 1801 secunde.","You recieved 40 gift points because you played 1801 seconds.");
				}
				else {
					PlayerInfo[i][pGiftTime] += 20;
					Update(i, pGiftTimex);
					SS(i,COLOR_LIGHTBLUE, "Ai primit 20 gift points pentru ca nu ai jucat 1801 secunde.","You recieved 20 gift points because you not played 1801 seconds.");
				}
				if(PlayerInfo[i][pMember] != 0)
				{
					PlayerInfo[i][pPaydayON]++;
					Update(i, pPaydayONx);
				}
				if(PlayerInfo[i][pLeader] > 0)
				{
					GivePlayerCash(i, 50000);
					format(string, sizeof(string), "Ai primit salariul de leader ($50000).");
					format(stringore, sizeof(stringore), "You recieved the leader salary ($50000).");
					SS(i, COLOR_LIGHTBLUE, string, stringore);
				}
				if(PlayerInfo[i][pHelper] > 0)
				{
					GivePlayerCash(i, 50000);
					format(string, sizeof(string), "Ai primit salariul de helper ($50000).");
					format(stringore, sizeof(stringore), "You recieved the helper salary ($50000).");
					SS(i, COLOR_LIGHTBLUE, string, stringore);
				}
				Update(i, pCashx);
				PlayerInfo[i][pPayDay] = 0;
				hourscount++;
				if(PlayerInfo[i][pLanguage] == 1)
				{
					format(stringore, sizeof(stringore), "You received %.2f hours played (%d minutes).",timee,floatround(timee2));
				}
				else
				{
					format(stringore, sizeof(stringore), "Ai primit %.2f ore jucate (%d minute).",timee,floatround(timee2));
				}
				SendClientMessage(i, COLOR_WHITE, stringore);
				if(PlayerInfo[i][pRob] < 20)
    			{
       				PlayerInfo[i][pRob]++;
       				Update(i, pRob);
           		}
           		else
           		{
           		    SS(i, COLOR_WHITE, "Nu ai primit niciun rob/free point pentru ca ai deja 20 rob/free points.", "No rob points for you! You have too many rob/free points. You can't store more than 20 rob/free points.");
				    Update(i, pRob);
				}
				PlayerInfo[i][pExp] += 1;
				PlayerInfo[i][pAccount] += finalinterest;
				/*format(string, sizeof(string), "Paycheck: $%s | Bank balance: $%s | Bank interest: $%s | Tax: $%s (10 percent)", FormatNumber(checks), FormatNumber(PlayerInfo[i][pAccount]), FormatNumber(finalinterest), 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, "----------------------------------------------------------------------------");*/
				//PayDaYTD {2b87ff}
			    format(string3, sizeof(string3), "PAYDAY:~n~Minute jucate: +%d~n~Paycheck: $%s ~n~ Bank balance: $%s ~n~ Bank interest: $%s ~n~ Tax: $%s (10 percent)~n~Rent: $%s | Total earnings: $%d",PlayerInfo[i][pPayDay]/60+1, FormatNumber(checks), FormatNumber(PlayerInfo[i][pAccount]), FormatNumber(finalinterest), FormatNumber(TaxValue), FormatNumber(rent[i]), checks-TaxValue);
			    PlayerTextDrawSetString(i, PayDayTD, string3);
			    PlayerTextDrawShow(i, PayDayTD);
			    format(string, sizeof(string), "~y~payday");
			    GameTextForPlayer(i, string, 5000, 1);
				format(string, sizeof(string), "~g~payday");
				GameTextForPlayer(i, string, 5000, 1);
				if(PlayerInfo[i][pRollPoints] < 100) PlayerInfo[i][pRollPoints] +=20, Update(i, pRollPointsx);
				format(string, sizeof(string), "Roll Points: %d/100", PlayerInfo[i][pRollPoints]);
				SCM(i, COLOR_LIGHTGREEN3, string);
				if(PlayerInfo[i][pCarLicT] > 0)
				{
					PlayerInfo[i][pCarLicT] -= 1;
					if(PlayerInfo[i][pCarLicT] == 0) SS(i, COLOR_YELLOW, "* Licenta ta de condus a expirat, poti merge la DMV pentru a obtine alta.","* Your driving licence was expired, you can go to the DMV to get another.");
				}
				if(PlayerInfo[i][pFlyLicT] > 0)
				{
					PlayerInfo[i][pFlyLicT] -= 1;
					if(PlayerInfo[i][pFlyLicT] == 0) SS(i, COLOR_YELLOW, "* Licenta ta de zburat a expirat, poti obtine alta contactand un instructor [/instructors].","* Your flying licence was expired, you can get antoher contacting a instructor [/instructors].");
				}
				if(PlayerInfo[i][pBoatLicT] > 0)
				{
					PlayerInfo[i][pBoatLicT] -= 1;
					if(PlayerInfo[i][pBoatLicT] == 0) SS(i, COLOR_YELLOW, "* Licenta ta de barci a expirat, poti obtine alta contactand un instructor [/instructors].","* Your boat licence was expired, you can get antoher contacting a instructor [/instructors].");
				}
				if(PlayerInfo[i][pGunLicT] > 0)
				{
					PlayerInfo[i][pGunLicT] -= 1;
					if(PlayerInfo[i][pGunLicT] == 0) SS(i, COLOR_YELLOW, "* Licenta ta de arme a expirat, poti obtine alta contactand un instructor [/instructors].","* Your weapon licence was expired, you can get antoher contacting a instructor [/instructors].");
				}
				if(PlayerInfo[i][pFpunish] > 0)
				{
					PlayerInfo[i][pFpunish]--;
		 		}
		 		if(PlayerInfo[i][pFpunish] < 0)
		 		{
	    			PlayerInfo[i][pFpunish] = 0;
				}
				if(PlayerInfo[i][pCarLicSuspend] > 0)
				{
					PlayerInfo[i][pCarLicSuspend]--;
					Update(i, pCarLicSuspendx);
					if(PlayerInfo[i][pCarLicSuspend] == 0) SS(i, COLOR_YELLOW, "* Licenta ta de condus a fost confiscata recent, acum poti merge iar la DMV pentru a obtine alta.","* Your driving licence was confiscated recently, now you can go to the DMV to get another.");
				}
				if(PlayerInfo[i][pGunLicSuspend] > 0)
				{
					PlayerInfo[i][pGunLicSuspend]--;
					Update(i, pGunLicSuspendx);
					if(PlayerInfo[i][pGunLicSuspend] == 0) SS(i, COLOR_YELLOW, "* Licenta ta de arme a fost confiscata recent, acum poti contacta un instructor pentru a obtine alta [/instructors].","* Your weapon licence was confiscated recently, now you can get antoher contacting a instructor [/instructors].");
				}
				PlayerInfo[i][pPayCheck] = 0;
				new month, day, inserted, dx;
				format(str, sizeof(str), "SELECT * FROM `timeplayed` WHERE `pid`='%d'", PlayerInfo[i][pSQLID]);
				new Cache: xd = mysql_query(SQL, str);
				if(cache_get_row_count() > 0)
				{
					for(new d, js = cache_get_row_count (); d != js; ++d)
					{
						month = cache_get_field_content_int(d, "month");
						day = cache_get_field_content_int(d, "day");
						if(day == da && month == mo)
						{
							inserted = 1;
						}
					}
				}
				else
				{
					mysql_format(SQL, str, sizeof(str), "INSERT INTO `timeplayed` (`pid`,`time`,`month`,`day`,`year`,`unixtime`) VALUES ('%d','%d','%s%d','%s%d','%d','%d')", PlayerInfo[i][pSQLID], OnlineTimeToday[i], ((mo < 10) ? ("0") : ("")), mo, ((da < 10) ? ("0") : ("")), da, ye, gettime());
					mysql_tquery(SQL, str, "", "");
					dx = 1;
					OnlineTimeToday[i] = 0;
					Update(i, pOnlineTimeTodayx);
				}
				cache_delete(xd);
				if(dx == 0)
				{
					if(inserted == 1)
					{
						mysql_format(SQL, str, sizeof(str), "UPDATE timeplayed SET time = time+%d WHERE month = %d AND day = %d AND pid = %d", OnlineTimeToday[i], mo, da, PlayerInfo[i][pSQLID]);
						mysql_tquery(SQL, str, "", "");
						OnlineTimeToday[i] = 0;
						Update(i, pOnlineTimeTodayx);
					}
					else
					{
						mysql_format(SQL, str, sizeof(str), "INSERT INTO `timeplayed` (`pid`,`time`,`month`,`day`,`year`,`unixtime`) VALUES ('%d','%d','%s%d','%s%d','%d','%d')", PlayerInfo[i][pSQLID], OnlineTimeToday[i], ((mo < 10) ? ("0") : ("")), mo, ((da < 10) ? ("0") : ("")), da, ye, gettime());
						mysql_tquery(SQL, str, "", "");
						OnlineTimeToday[i] = 0;
						Update(i, pOnlineTimeTodayx);
					}
				}
				UpdateProgressBar(i); 
			}
		}
	}
	format(str, sizeof(str), "INSERT INTO `toph` (`ponline`,`hour`) VALUES ('%d','%s%d:00')", GetOnLinePlayers(), ((hour < 10) ? ("0") : ("")), hour);
	mysql_query(SQL, str);
	mysql_query(SQL, "DELETE FROM `toph` ORDER BY `id` ASC limit 1");
	format(str, sizeof(str), "SELECT * FROM `timeonline` WHERE m = %d AND y = %d",mo,ye);
	new Cache: result = mysql_query(SQL, str);
	if(cache_get_row_count() >= 1)
	{
		mysql_format(SQL,str,sizeof(str),"UPDATE timeonline SET hoursplayed = hoursplayed+%d WHERE m = %d AND y = %d",hourscount,mo,ye);
		mysql_tquery(SQL,str,"","");
	}
	cache_delete(result);
	SetTimer("hidePayDay", 10000, false);
	return 1;
}

 

Edited by SpriteTV
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Verifica daca ai gm bigzone,  Update(i, pRobx);

si vezi unde ai

 

case pRobx: daca ai UPDATE `users` SET `Rob` sau cum ai tu ='%d'

Sa fie egal cu %d deoarece %d reprezinta numar.

Sa nu ai %f sau alte chestii. Si vezi cum e facut tabelul in baza de date, sa nu fie conform conditiei pe 0, doar il adaugi Rob sau cum e salvat in baza de date.

 

Da, alta rezolvare ar fi sa verifici cum e tabelul in baza de date in care trebuie sa se salveze ca poate in gm ai update users set `rob1` dar in baza de date este rob. Si mai vezi daca este where name='%s' pnormalname. etc.

 

Ca am patit acu 2 zile nu mi se salva cand dadeam /getjob si nu aveam WHERE `name`='%s' aveam WHERE `name`='s' si nu vedeam % ala si nu ii dadeam de cap, deci uitate foarte atent. Astea sunt rezolvarile, altele nu cred...

Link to comment
Share on other sites

  • 0
Acum 30 minute, AlexxAdv a spus:

Verifica daca ai gm bigzone,  Update(i, pRobx);

si vezi unde ai

 

case pRobx: daca ai UPDATE `users` SET `Rob` sau cum ai tu ='%d'

Sa fie egal cu %d deoarece %d reprezinta numar.

Sa nu ai %f sau alte chestii. Si vezi cum e facut tabelul in baza de date, sa nu fie conform conditiei pe 0, doar il adaugi Rob sau cum e salvat in baza de date.

 

Da, alta rezolvare ar fi sa verifici cum e tabelul in baza de date in care trebuie sa se salveze ca poate in gm ai update users set `rob1` dar in baza de date este rob. Si mai vezi daca este where name='%s' pnormalname. etc.

 

Ca am patit acu 2 zile nu mi se salva cand dadeam /getjob si nu aveam WHERE `name`='%s' aveam WHERE `name`='s' si nu vedeam % ala si nu ii dadeam de cap, deci uitate foarte atent. Astea sunt rezolvarile, altele nu cred...

am gm bigzone dar adus intr`o stare mult avansata si facut pe include-uri.

dar mai bagat rau inceata cu baza de date

Edited by SpriteTV
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.