/signcheck [Numbers]
#1

Hey I want to make a /signcheck on payday so if your AFK you don't just get money.

it would look something like:
new checknumber = 1000 + random(8999);
new CheckNumber[playerid] = checknumber
new CheckNumber[MAX_PLAYERS];

That's all I know what to do atm. Ive searched and nothing is found with the signcheck.

It would have something to do with the
Public PayDay();

Thanks
Reply
#2

//On top of your script:
Код:
new CheckNumber[MAX_PLAYERS];
forward PayDay();
Код:
public PayDay();
{
  new string[128];
  for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
      CheckNumber[i] = 1000+random(8999);
      format(string, 128, "To receive your payday-money, please type: \"sighcheck %d\"", CheckNumber[i]);
      SendClientMessage(playerid, 0x00FF00AA, string);
    }
  }
}
@your OnPlayerCommandText-callback:
Код:
if(strcmp(cmdtext, "/signcheck", 10)==0)
{
  if(!strlen(cmdtext[11]))
  {
    SendClientMessage(playerid, 0xFF0000AA, "Use: /signcheck [checknumber]");
    return 1;
  }
  new number = strval(cmdtext[11]);
  if(number == CheckNumber[playerid])
  {
    SendClientMessage(playerid, 0x00FF00AA, "You received your money!");
    GivePlayerMoney(playerid, ENTER_HERE_THE_AMOUNT!!);
  }
  else
  {
    SendClientMessage(playerid, 0xFF0000AA, "Wrong checknumber!");
  }
  return 1;
}
Reply
#3

Okay it works but when it comes to payday it says
It is now Payday, please type: /signcheck {number}

Which is good but then it says
"You havn't played long enough to obtain a payday"

It doesn't wait for me to /signcheck it just gives the money.
Reply
#4

Okay it works but when it comes to payday it says
It is now Payday, please type: /signcheck {number}

Which is good but then it says
"You havn't played long enough to obtain a payday"

It doesn't wait for me to /signcheck it just gives the money.
Reply
#5

Thats proberly something to do with your script,
If your going to use that you should take out all the bits of payday script thats already scripted in.
Reply
#6

All it does now is say /signcheck [numbers] so I do that and then nothing happens?
Any ideas. heres my code:


Код:
public PayDay()
{
	new string[128];
	for (new i=0; i<MAX_POINTS; i++)
	{
		Points[i][Announced] = 0;
		if (Points[i][Vulnerable] > 0)
		{
			Points[i][Vulnerable]--;
			UpdatePoints();
		}
	}
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(IsPlayerConnected(i))
		{
			CheckNumber[i] = 1000+random(8999);
			format(string, 128, "It is now Payday, please type: \"/signcheck %d\"", CheckNumber[i]);
 			SendClientMessage(i, COLOR_LIGHTBLUE, string);
		}
	}
	return 1;
}



_______________________________________________________________________________________


	if(strcmp(cmdtext, "/signcheck", true)==0)
	{
	  // is player signing check connected
		if(IsPlayerConnected(playerid))
		{
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /signcheck [numbers]");
				return 1;
			}
			new string[128];
			new account,interest;
			new rent = 0;
			// if they are above level 0
		  if(PlayerInfo[playerid][pLevel] > 0)
		  {
			  if(MoneyMessage[playerid]==1)
				{
					SendClientMessage(playerid, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
					GameTextForPlayer(playerid, "~r~Busted!", 2000, 1);
					SetPlayerInterior(playerid, 6);
			  		SetPlayerPos(playerid, 264.6288,77.5742,1001.0391);
		    	PlayerInfo[playerid][pJailed] = 1;
		    	ResetPlayerWeapons(playerid);
					WantedPoints[playerid] = 0;
					PlayerInfo[playerid][pJailTime] = 240;
					format(string, sizeof(string), "You are jailed for %d seconds.  Bail: Unable", PlayerInfo[playerid][pJailTime]);
					SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
				}
				new playername2[MAX_PLAYER_NAME];
				GetPlayerName(playerid, playername2, sizeof(playername2));
				account = PlayerInfo[playerid][pAccount];
				new key = PlayerInfo[playerid][pPhousekey];
				if(key != 255)
				{
					rent = HouseInfo[key][hRent];
					if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
					{
						rent = 0;
					}
					else if(rent > GetPlayerMoney(playerid))
					{
						PlayerInfo[playerid][pPhousekey] = 255;
						SendClientMessage(playerid, 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[playerid][pDonateRank] > 0) { tmpintrate = intrate+4; }
					else { tmpintrate = intrate+2; }//HouseInfo[key][hLevel]
				}
				else
				{
					if(PlayerInfo[playerid][pDonateRank] > 0) { tmpintrate = 3; }
					else { tmpintrate = 1; }
				}
				if(PlayerInfo[playerid][pPayDay] >= 5)
				{
				  new number = strval(tmp);
 					if(number == CheckNumber[playerid])
  				{
  					SendClientMessage(playerid, 0x00FF00AA, "You received your money!");
						Tax += TaxValue;//Should work for every player online
						PlayerInfo[playerid][pAccount] -= TaxValue;
						if(PlayerInfo[playerid][pDonateRank] > 0)
						{
				  			new bonus = PlayerInfo[playerid][pPayCheck] / 2;
				  			PlayerInfo[playerid][pPayCheck] += bonus;
						}
						new checks = PlayerInfo[playerid][pPayCheck];
				  	new ebill = (PlayerInfo[playerid][pAccount]/10000)*(PlayerInfo[playerid][pLevel]);
				  	ConsumingMoney[playerid] = 1;
				  	GivePlayerMoney(playerid, checks);
				  	if(PlayerInfo[playerid][pAccount] > 0)
				  	{
				  		PlayerInfo[playerid][pAccount] -= ebill;
				  		SBizzInfo[4][sbTill] += ebill;
						}
						else
						{
					  	ebill = 0;
						}
						interest = (PlayerInfo[playerid][pAccount]/1000)*(tmpintrate);
						PlayerInfo[playerid][pExp]++;
						PlayerPlayMusic(playerid);
						PlayerInfo[playerid][pAccount] = account+interest;
						SendClientMessage(playerid, COLOR_WHITE, "|___ BANK STATMENT ___|");
						format(string, sizeof(string), " Paycheck: $%d  Tax Money: -$%d", checks, TaxValue);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						if(PlayerInfo[playerid][pPhousekey] != 255 || PlayerInfo[playerid][pPbiskey] != 255)
						{
					  	format(string, sizeof(string), " Electricity Bill: -$%d", ebill);
							SendClientMessage(playerid, COLOR_GRAD1, string);
						}
						format(string, sizeof(string), " Balance: $%d", account);
						SendClientMessage(playerid, COLOR_GRAD1, string);
						format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate);
						SendClientMessage(playerid, COLOR_GRAD2, string);
						format(string, sizeof(string), " Interest Gained $%d", interest);
						SendClientMessage(playerid, COLOR_GRAD3, string);
						SendClientMessage(playerid, COLOR_GRAD4, "|--------------------------------------|");
						format(string, sizeof(string), " New Balance: $%d", PlayerInfo[playerid][pAccount]);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						format(string, sizeof(string), " Rent: -$%d", rent);
						SendClientMessage(playerid, COLOR_GRAD5, string);
						format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
						GameTextForPlayer(playerid, string, 5000, 1);
						rent = 0;
						PlayerInfo[playerid][pPayDay] = 0;
						PlayerInfo[playerid][pPayCheck] = 0;
						PlayerInfo[playerid][pConnectTime] += 1;
						if(PlayerInfo[playerid][pDonateRank] > 0)
						{
					  	PlayerInfo[playerid][pPayDayHad] += 1;
					  	if(PlayerInfo[playerid][pPayDayHad] >= 5)
					  	{
					  		PlayerInfo[playerid][pExp]++;
					  		PlayerInfo[playerid][pPayDayHad] = 0;
					  	}
						}
					}
					else
					{
			  			SendClientMessage(playerid, 0xFF0000AA, "Wrong checknumber!");
					}
				}
				else
				{
  					SendClientMessage(playerid, COLOR_LIGHTRED, "* You haven't played long enough to obtain a PayDay.");
  				}
			}
		}
 		Checkprop();
		return 1;
	}
Reply
#7

This crashes my compiler, any suggestions?
Reply
#8

Yeah this crashes my Compiler too.
Reply
#9

Fix brackets.
Reply
#10

Okay I got it in, but when Im ingame and I get pay day it gives it to me like it would normaly, heres my format on payday, any suggestions?

Код:
public PayDay()
{
  new string[128];
	new account,interest;
	new rent = 0;
	for(new i; i<MAX_PLAYERS; i++)
  {
    if(IsPlayerConnected(i))
    {
			CheckNumber[i] = 1000+random(8999);
      format(string, 128, "It is now payday, please type: \"/sighcheck %d\"", CheckNumber[i]);
      SendClientMessage(i, COLOR_LIGHTBLUE, string);
			if(PlayerInfo[i][pLevel] > 0)
		  {
			  else(MoneyMessage[i]==1)
				{
				  SendClientMessage(i, COLOR_LIGHTRED, "You failed to pay your debt, Jail time.");
				  GameTextForPlayer(i, "~r~Busted!", 2000, 1);
				  SetPlayerInterior(i, 6);
				  PlayerInfo[i][pInt] = 6;
			 		SetPlayerPos(i, 264.6288,77.5742,1001.0391);
		      PlayerInfo[i][pJailed] = 1;
		      SafeResetPlayerWeapons(i);
		      SafeResetPlayerMoney(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_WHITE, 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;
					new checks = PlayerInfo[i][pPayCheck] / 5;
					if(PlayerInfo[i][pDonateRank] > 0)
					{
					  new bonus = PlayerInfo[i][pPayCheck] / 10;
					  checks += bonus;
					}
				  new ebill = (PlayerInfo[i][pAccount]/10000)*(PlayerInfo[i][pLevel]);
				  //ConsumingMoney[i] = 1;
				  //SafeGivePlayerMoney(i, checks);
				  account += 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_GREEN, "|___ BANK STATMENT ___|");
					format(string, sizeof(string), " Paycheck: $%d Tax Money: -$%d", checks, TaxValue);
					SendClientMessage(i, COLOR_WHITE, 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 - checks);
					SendClientMessage(i, COLOR_WHITE, 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_GREEN, "|--------------------------------------|");
					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~Check paid into your account");
					GameTextForPlayer(i, string, 5000, 1);
					rent = 0;
					PlayerInfo[i][pPayDay] = 0;
					PlayerInfo[i][pPayCheck] = 0;
					PlayerInfo[i][pConnectTime] += 1;
					if(FarmerVar[i] == 0)
					{
						FarmerPickup[i][0] = 0;
					}
					if(DrugFarmerVar[i] == 0)
					{
						DrugFarmerPickup[i][0] = 0;
					}
					if(SmugglerWork[i] == 0)
					{
						PayDaySecure[i] = 0;
					}
					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_WHITE, "* You haven't played long enough to obtain a PayDay.");
				}
			}
		}
	}
	SaveAccounts();
	Checkprop();
	return 1;
}
Then the /signcheck is below here:

Код:
	if(strcmp(cmdtext, "/signcheck", 10)==0)
	{
  	if(!strlen(cmdtext[11]))
  	{
    	SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /signcheck [check number]");
    	return 1;
  	}
  	new number = strval(cmdtext[11]);
  	if(number == CheckNumber[playerid])
  	{
    	SendClientMessage(playerid, COLOR_GREEN, "You received your money!");
    	GivePlayerMoney(playerid, 5432);
		}
  	else
  	{
    	SendClientMessage(playerid, COLOR_RED, "Wrong checknumber!");
  	}
  	return 1;
	}
//---------------------getip------------------
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)