SA-MP Forums Archive
[HELP] fishing permet - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] fishing permet (/showthread.php?tid=67968)



[HELP] fishing permet - linxx - 05.03.2009

Hello guys im stuck on this one well here i go.. i have made a fishing license that expires after 5 paydays like a permit but the problem im havin is when it gets to the 6th payday the permit hours start going in minus and keeps going back so when you buy another u have to buy 2 or 3 to top up the munus hours to get back into plus. so my question is any idea how to fix it ??

regards ktr



Код:
pFishLicenseTime,
PlayerInfo[playerid][pFishLicenseTime] = 0;
-----------------------------------------------

  if (GetPlayerMoney(playerid) > 500)
				{
				
				PlayerInfo[playerid][pFishLicenseTime] += 5;
				PlayerInfo[playerid][pFishLic] = 1;
				SendClientMessage(playerid, COLOR_GREY, "  You have been charged $500 for your purchase.");
				SendClientMessage(playerid,COLOR_GREY,"  Congratulations! You now have a 5 Hour fishing Permit.");
				SendClientMessage(playerid, COLOR_GRAD5, "You can check this anytime by typing /licenses");
		    SafeGivePlayerMoney(playerid,-500);
		    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
		  	TogglePlayerControllable(playerid, 1);
				return 1;
				}
				else
				{
		    	SendClientMessage(playerid, COLOR_YELLOW, "You don't have enough cash.");
		    	TogglePlayerControllable(playerid, 1);

//---------- this bit in payday--------------

					format(string, sizeof(string), " Balance: $%d", account);
					SendClientMessage(i, COLOR_GRAD1, string);
					format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate);
					SendClientMessage(i, COLOR_GRAD2, string);
					format(string, sizeof(string), " Interest Gained $%d", interest);
					SendClientMessage(i, COLOR_GRAD3, string);
					SendClientMessage(i, COLOR_GRAD4, "|--------------------------------------|");
					format(string, sizeof(string), " New Balance: $%d", PlayerInfo[i][pAccount]);
					SendClientMessage(i, COLOR_GRAD5, string);
					format(string, sizeof(string), " Rent: -$%d", rent);
					SendClientMessage(i, COLOR_GRAD5, string);
					format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
					GameTextForPlayer(i, string, 5000, 1);
					rent = 0;
					PlayerInfo[i][pPayDay] = 0;
					PlayerInfo[i][pPayCheck] = 0;
					PlayerInfo[i][pConnectTime] += 1;
					PlayerInfo[i][pDonorExtraPay]++;
					PlayerInfo[i][pFishLicenseTime] -= 1;
					
					if (PlayerInfo[i][pFishLic] == 1 && PlayerInfo[i][pFishLicenseTime] <= 0)
					{
						PlayerInfo[i][pFishLic] = 0;
						PlayerInfo[i][pFishLicenseTime] = 0;
						SendClientMessage(i, COLOR_LIGHTRED, "* Your Fishing License has expired!");
					}

					if (PlayerInfo[i][pFishingPole] > 0)
					{
						if ( (PlayerInfo[i][pFishLicenseTime] / 5) == 1)
						{
							PlayerInfo[i][pFishingPole] = 0;
							SendClientMessage(i, COLOR_LIGHTRED, "* Your Fishing Pole has broken!");
						}
					}
				format(var, 32, "FishTime=%d\n",PlayerInfo[playerid][pFishLicenseTime]);fwrite(hFile, var);

	if( strcmp( key , "FishTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFishLicenseTime] = strvalEx( val ); }

-----------------this in licenses---------------------

format(string, sizeof(string), "** Fishing License: %s. (%d Hours Left)", text3, PlayerInfo[playerid][pFishLicenseTime]);



Re: [HELP] fishing permet - Mikep - 05.03.2009

What's a permet?


Re: [HELP] fishing permet - Snyper18 - 05.03.2009

He means a "fishing permit", The thing with you Mikep, You always make people look stupid, Yet you never really help.
Smartass.


Re: [HELP] fishing permet - Mikep - 05.03.2009

I help alot of people unknown to you.

Plus your "yet" shouldn't be capitalized, as it's after a comma!


Re: [HELP] fishing permet - Snyper18 - 05.03.2009

Quote:
Originally Posted by Mikep
I help alot of people unknown to you.

Plus your "yet" shouldn't be capitalized, as it's after a comma!
Correct my other mistake will yeah?


Re: [HELP] fishing permet - linxx - 06.03.2009

So no actual help then? lol


Re: [HELP] fishing permet - [RP]Rav - 06.03.2009

About the problem with the amount of licenses
replace
pawn Код:
PlayerInfo[playerid][pFishLicenseTime] += 5;
with
pawn Код:
PlayerInfo[playerid][pFishLicenseTime] = 5;



Re: [HELP] fishing permet - MenaceX^ - 06.03.2009

I don't understand what needs to be fixed here?


Re: [HELP] fishing permet - Linxx87 - 13.03.2009

Well what i can make of it is that when each payday has gone it takes 1 hour of his 5 hour fishing permet and when the 5 hours is up it starts going backwards so his fishing permet is in minus like -1 -2 --3 and on and on so what i think he wants is it to stop at 0 and not continue going down


Re: [HELP] fishing permet - Kinetic - 13.03.2009

replace this

pawn Код:
PlayerInfo[i][pFishLicenseTime] -= 1;
with this.

pawn Код:
if(PlayerInfo[i][pFishLicenseTime] > 0)
{
  PlayerInfo[i][pFishLicenseTime] -= 1;
}
That will stop the fishing license time from dropping below 0.


_________________________________________
Alt: You can also do this as an alternate way.
pawn Код:
PlayerInfo[i][pFishLicenseTime] -= 1;
if(Playerinfo[i][pFishLicenseTime] <= 0)
{
  PlayerInfo[i][pFishLicenseTime]++;
}
This will still drop the amount by 1, but then checks if its below 0 and if it is, it adds 1. This makes it 0 again. Both ways will work. Its up to you which you prefer.