SA-MP Forums Archive
Bank Bug - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Bank Bug (/showthread.php?tid=491015)



Bank Bug - betta - 29.01.2014

I have recently added a 2nd bank to my server but 1 of them works and one says you have left the bank even tro you are standing at the spot. Can you help me

Код:
if(PlayerInfo[i][pRobbingBank] >= 1) {
		    new string[128];
			if(!IsPlayerInRangeOfPoint(i, 15.0, 2308.7346, -11.0134, 26.7422)) {
			    GameTextForPlayer(i, "~r~Robbery Failed...~n~You left the bank...", 5000, 5);
			    PlayerInfo[i][pRobbingBank] =0;
			    return 1;
			}
			if(PlayerInfo[i][pRobbingBank] > 1) {
				format(string,sizeof(string),"~r~Robbing Bank...~n~~w~Complete in ~b~%d ~w~seconds...",PlayerInfo[i][pRobbingBank]);
			    GameTextForPlayer(i, string, 1000, 5);
				PlayerInfo[i][pRobbingBank] --;
				return 1;
			}
	  		new rrand = random(300000);
	  		new year,month,day,log[128];
			format(string,sizeof(string),"* %s has robbed $%d from the bank safe.",GetPlayerNameEx(i),rrand);
	        ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	        GivePlayerCash(i, rrand);
	        getdate(year, month, day);
			format(log, sizeof(log), "%s has just robbed the bank and recieved $%d (%d-%d-%d)", GetPlayerNameEx(i), rrand, month, day, year);
			Log("logs/robs.log", log);
			PlayerInfo[i][pRobbingBank] =0;
			return 1;
	    }
		if(PlayerInfo[i][pRobbingBank] >= 1) {
		    new string[128];
			if(!IsPlayerInRangeOfPoint(i, 15.0, 2942.5620, -1769.4794, 1178.4684)) {
			    GameTextForPlayer(i, "~r~Robbery Failed...~n~You left the bank...", 5000, 5);
			    PlayerInfo[i][pRobbingBank] =0;
			    return 1;
			}
			if(PlayerInfo[i][pRobbingBank] > 1) {
				format(string,sizeof(string),"~r~Robbing Bank...~n~~w~Complete in ~b~%d ~w~seconds...",PlayerInfo[i][pRobbingBank]);
			    GameTextForPlayer(i, string, 1000, 5);
				PlayerInfo[i][pRobbingBank] --;
				return 1;
			}
	  		new rrand = random(300000);
	  		new year,month,day,log[128];
			format(string,sizeof(string),"* %s has robbed $%d from the bank safe.",GetPlayerNameEx(i),rrand);
	        ProxDetector(30.0, i, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
	        GivePlayerCash(i, rrand);
	        getdate(year, month, day);
			format(log, sizeof(log), "%s has just robbed the bank and recieved $%d (%d-%d-%d)", GetPlayerNameEx(i), rrand, month, day, year);
			Log("logs/robs.log", log);
			PlayerInfo[i][pRobbingBank] =0;
			return 1;



Re: Bank Bug - Smileys - 29.01.2014

pawn Код:
if(!IsPlayerInRangeOfPoint(i, 15.0, 2308.7346, -11.0134, 26.7422))
I suppose this is 1 coordinate, meaning 1 bank, meaning when the player ain't at that spot it will give the message: you have left the bank.

just add another check with the second bank coords, like:

pawn Код:
if(!IsPlayerInRangeOfPoint(i, 15.0, 2308.7346, -11.0134, 26.7422) || !IsPlayerInRangeOfPoint( i, 15.0, x, y, z ) )