SA-MP Forums Archive
Payday problem - 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: Payday problem (/showthread.php?tid=84903)



Payday problem - anumaz - 03.07.2009

Hey, I'm using the gamemode named GodFather and there's a problem. The payday isn't working well. I mean, it doesn't do anything, it's like if it would not exists. Here is every things related to the payday, in my script:

Код:
forward PayDay();

enum pinfo {
pPayDay,
pPayDayHad,
}

public onconnect {
	PlayerInfo[playerid][pPayDay] = 0;
	PlayerInfo[playerid][pPayDayHad] = 0;
}


public SyncTime()
{
	new string[64];
	new tmphour;
	new tmpminute;
	new tmpsecond;
	gettime(tmphour, tmpminute, tmpsecond);
	FixHour(tmphour);
	tmphour = shifthour;
	if ((tmphour > ghour) || (tmphour == 0 && ghour == 23))
	{
		format(string, sizeof(string), "SERVEUR: L'heure est maintenant %d:00",tmphour);
		BroadCast(COLOR_WHITE,string);
		ghour = tmphour;
		PayDay();
		if (realtime)
		{
			SetWorldTime(tmphour);
		}
	}
}


public PayDay()
{
	new string[128];
	new account,interest;
	new rent = 0;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
		  if(PlayerInfo[i][pLevel] > 0)
		  {
			  if(MoneyMessage[i]==1)
				{
				  SendClientMessage(i, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
				  GameTextForPlayer(i, "~r~Busted!", 2000, 1);
				  SetPlayerInterior(i, 6);
			  		SetPlayerPos(i, 264.6288,77.5742,1001.0391);
		      PlayerInfo[i][pJailed] = 1;
		      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);
				}
				new playername2[MAX_PLAYER_NAME];
				GetPlayerName(i, playername2, sizeof(playername2));
				account = PlayerInfo[i][pAccount];
				new key = PlayerInfo[i][pPhousekey];
				if(key != 255)
				{
					rent = HouseInfo[key][hRent];
					if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
					{
						rent = 0;
					}
					else if(rent > GetPlayerMoney(i))
					{
						PlayerInfo[i][pPhousekey] = 255;
						SendClientMessage(i, COLOR_WHITE, "You have been evicted.");
						rent = 0;
					}
					HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent;
				}
				new tmpintrate;
				if (key != 255 && strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
				{
				  if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = intrate+4; }
					else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel]
				}
				else
				{
				  if(PlayerInfo[i][pDonateRank] > 0) { tmpintrate = 3; }
					else { tmpintrate = 1; }
				}
				if(PlayerInfo[i][pPayDay] >= 5)
				{
				  Tax += TaxValue;//Should work for every player online
				  PlayerInfo[i][pAccount] -= TaxValue;
				  if(PlayerInfo[i][pDonateRank] > 0)
					{
					  new bonus = PlayerInfo[i][pPayCheck] / 2;
					  PlayerInfo[i][pPayCheck] += bonus;
					}
					new checks = PlayerInfo[i][pPayCheck];
				  new ebill = (PlayerInfo[i][pAccount]/10000)*(PlayerInfo[i][pLevel]);
				  ConsumingMoney[i] = 1;
				  GivePlayerMoney(i, checks);
				  if(PlayerInfo[i][pAccount] > 0)
				  {
				  	PlayerInfo[i][pAccount] -= ebill;
				  	SBizzInfo[4][sbTill] += ebill;
					}
					else
					{
					  ebill = 0;
					}
					interest = (PlayerInfo[i][pAccount]/1000)*(tmpintrate);
					PlayerInfo[i][pExp]++;
					PlayerPlayMusic(i);
					PlayerInfo[i][pAccount] = account+interest;
					SendClientMessage(i, COLOR_WHITE, "|___ BANK STATMENT ___|");
					format(string, sizeof(string), " Paycheck: $%d  Tax Money: -$%d", checks, TaxValue);
					SendClientMessage(i, COLOR_GRAD1, string);
					if(PlayerInfo[i][pPhousekey] != 255 || PlayerInfo[i][pPbiskey] != 255)
					{
					  format(string, sizeof(string), " Electricity Bill: -$%d", ebill);
						SendClientMessage(i, COLOR_GRAD1, string);
					}
					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~Jour de Paye~n~~w~Cheque");
					GameTextForPlayer(i, string, 5000, 1);
					rent = 0;
					PlayerInfo[i][pPayDay] = 0;
					PlayerInfo[i][pPayCheck] = 0;
					PlayerInfo[i][pConnectTime] += 1;
					if(PlayerInfo[i][pDonateRank] > 0)
					{
					  PlayerInfo[i][pPayDayHad] += 1;
					  if(PlayerInfo[i][pPayDayHad] >= 5)
					  {
					    PlayerInfo[i][pExp]++;
					    PlayerInfo[i][pPayDayHad] = 0;
					  }
					}
				}
				else
				{
				  SendClientMessage(i, COLOR_LIGHTRED, "* Vous n'avez pas jouй assez longtemps pour obtenir une paye.");
				}
			}
		}
	}
	Checkprop();
	return 1;
}


public OnPlayerRegister {
				format(var, 32, "PayDay=%d\n",PlayerInfo[playerid][pPayDay]);fwrite(hFile, var);
				format(var, 32, "PayDayHad=%d\n",PlayerInfo[playerid][pPayDayHad]);fwrite(hFile, var);
}

public OnPlayerUpdate {
				format(var, 32, "PayDay=%d\n",PlayerInfo[playerid][pPayDay]);fwrite(hFile, var);
				format(var, 32, "PayDayHad=%d\n",PlayerInfo[playerid][pPayDayHad]);fwrite(hFile, var);
}

public OnPlayerLogin {
			    if( strcmp( key , "PayDay" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayDay] = strval( val ); }
			    if( strcmp( key , "PayDayHad" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayDayHad] = strval( val ); }
}



	if(strcmp(cmd, "/payday", true) == 0)
	{
		if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 1337)
		{
		PayDay();
		}
		else
		{
		SendClientMessage(playerid, COLOR_GRAD1, "Vous n'avez pas le pouvoir d'utiliser cette commande.");
		}
		return 1;
	}
It's in order, if you need more infos, tell me

Thanks


Re: Payday problem - ACERS - 03.07.2009

Ask in the godfather thread...


Re: Payday problem - anumaz - 03.07.2009

That's what I did, but no one is answering ...


Re: Payday problem - Grim_ - 03.07.2009

Quote:
Originally Posted by anumaz
That's what I did, but no one is answering ...
Ask again.


Re: Payday problem - anumaz - 03.07.2009

Quote:
Originally Posted by Swift_
Quote:
Originally Posted by anumaz
That's what I did, but no one is answering ...
Ask again.
Aight, I just did it.


Re: Payday problem - Grim_ - 03.07.2009

Quote:
Originally Posted by anumaz
Quote:
Originally Posted by Swift_
Quote:
Originally Posted by anumaz
That's what I did, but no one is answering ...
Ask again.
Aight, I just did it.
You origionally asked less than an hour ago, so be patient. Some people have to wait days before getting an answer. Jeez.


Re: Payday problem - anumaz - 04.07.2009

Quote:
Originally Posted by Swift_
Quote:
Originally Posted by anumaz
Quote:
Originally Posted by Swift_
Quote:
Originally Posted by anumaz
That's what I did, but no one is answering ...
Ask again.
Aight, I just did it.
Okay... I just hope that someone will answer XD
You origionally asked less than an hour ago, so be patient. Some people have to wait days before getting an answer. Jeez.