Need some help
#1

I have this code and I was trying to make it so I earn 0.1% of the savings you have. For example, if you had $50k in savings, you'd make $500. Can anyone help me? I don't know how to do this.

Код HTML:
stock Paycheck()
{
	// Bank Robbery
	if(BankRobberyTime) BankRobberyTime --;
	// Bonus Calculation
	new bonus;
	foreach(Player, i)
	{
	    if(IsPlayerLoggedIn(i)) bonus ++;
	}
	bonus = bonus*2;
	// Paycheck
	foreach(Player, i)
	{
	    if(IsPlayerLoggedIn(i))
	    {
	        if(PlayerInfo[i][pMinutes] >= 45)
	        {
	            new string[256], idx;
	            // Calculating Paycheck
		        new paycheck = ((PlayerInfo[i][pMinutes]*PlayerInfo[i][pMinutes]) / 20) * PlayerInfo[i][pLevel];
		        new taxamount = (TaxPercent * paycheck) / 100;
		        new finalpaycheck = paycheck - taxamount;
		        if(PlayerInfo[i][pInternet]) {finalpaycheck = finalpaycheck - 50; TaxMoney += 50;}
		        idx = PlayerInfo[i][pBiz];
		        if(PlayerInfo[i][pBiz]) {finalpaycheck = finalpaycheck - (BizInfo[idx][bLevel] * 10 * PlayerInfo[i][pLevel]); TaxMoney += (BizInfo[idx][bLevel] * 10 * PlayerInfo[i][pLevel]);}
                idx = PlayerInfo[i][pHouse];
				if(PlayerInfo[i][pHouse]) {finalpaycheck = finalpaycheck - (HouseInfo[idx][hLevel] * 5 * PlayerInfo[i][pLevel]); TaxMoney += (HouseInfo[idx][hLevel] * 10 * PlayerInfo[i][pLevel]);}
				if(PlayerInfo[i][pVIP] == 2) {finalpaycheck = finalpaycheck * (115/100);}
				if(PlayerInfo[i][pVIP] == 3) {finalpaycheck = finalpaycheck * (120/100);}
				if(PlayerInfo[i][pVIP] == 4) {finalpaycheck = finalpaycheck * (130/100);}
				finalpaycheck = finalpaycheck + ((bonus/100)*finalpaycheck);
				// Increasing Respect
				new calc, stack[4];
				if(PlayerInfo[i][pMinutes] >= 120)
				{
					calc = (PlayerInfo[i][pMinutes]/60);
					format(stack, sizeof(stack), "%d", calc);
			        PlayerInfo[i][pExp] += strval(stack);
		        }
		        else
		        {
		            PlayerInfo[i][pExp] ++;
		            PlayerInfo[i][pHours] ++;
		        }
		        if(DayRespectEnd >= 1)
				{
                    PlayerInfo[i][pExp] ++;
					SendClientMessage(i, COLOR_GREY, "* You have been given 1 additional respect point due to the current day ((/day))");
				}
		        /*// Levels: 1-30
				new OldLevel = PlayerInfo[i][pLevel];
		        if(PlayerInfo[i][pLevel] == 1 && PlayerInfo[i][pExp] >= 4) PlayerInfo[i][pLevel]++;
		        else if(PlayerInfo[i][pLevel] == 2 && PlayerInfo[i][pExp] >= 8) PlayerInfo[i][pLevel]++;
		        else if(PlayerInfo[i][pLevel] == 30 && PlayerInfo[i][pExp] >= 369) PlayerInfo[i][pLevel]++;
		        else if(PlayerInfo[i][pLevel] == 31 && PlayerInfo[i][pExp] >= 425) PlayerInfo[i][pLevel]++;
                new NewLevel = PlayerInfo[i][pLevel];
		        // Setting Level*/
		        SetPlayerScore(i, PlayerInfo[i][pHours]);
		        new oldbalance = PlayerInfo[i][pBank];
		        PlayerInfo[i][pBank] += finalpaycheck;
		        TaxMoney += taxamount;
		        // Paycheck Report
	    		format(string, sizeof(string), "|___ BANK STATEMENT ___|", PlayerInfo[i][pMinutes]);
	    		SendClientMessage(i, COLOR_FADE1, string);
	    		format(string, sizeof(string), "{A4A4A4}Minutes Played: {F5F5F5}%d", PlayerInfo[i][pMinutes]);
	    		SendClientMessage(i, COLOR_FADE1, string);
	    		format(string, sizeof(string), "{A4A4A4}Paycheck: {F5F5F5}$%d  {A4A4A4}Tax Amount: {F5F5F5}$%d (%d percent)  {A4A4A4}Total Paycheck: {F5F5F5}$%d", paycheck, taxamount, TaxPercent, finalpaycheck);
				SendClientMessage(i, COLOR_FADE1, string);
	    		format(string, sizeof(string), "{A4A4A4}Old Balance: {F5F5F5}$%d  {A4A4A4}New Balance: {F5F5F5}$%d", oldbalance, PlayerInfo[i][pBank]);
	    		SendClientMessage(i, COLOR_FADE1, string);
	    		/*if(PlayerInfo[i][pMinutes] >= 120)
				{
					format(string, sizeof(string), "* You have been given {F5F5F5}%d{A4A4A4} respect points for playing for {F5F5F5}%d{A4A4A4} minutes.", strval(stack), PlayerInfo[i][pMinutes]);
	            	if(PlayerInfo[i][pVIPBuddy]) PlayerInfo[i][pVIPBuddy] -= strval(stack);
				}
				else
				{
					format(string, sizeof(string), "* You have been given {F5F5F5}1{A4A4A4} respect point for playing for {F5F5F5}%d{A4A4A4} minutes.", PlayerInfo[i][pMinutes]);
	            	if(PlayerInfo[i][pVIPBuddy]) PlayerInfo[i][pVIPBuddy] --;
				}*/
				SendClientMessage(i, COLOR_GREY, string);
				if(PlayerInfo[i][pInternet]) SendClientMessage(i, COLOR_GREY, "* You have been charged {F5F5F5}$50{A4A4A4} for having smartphone internet service activated.");
                idx = PlayerInfo[i][pBiz];
				if(PlayerInfo[i][pBiz])
				{
				    format(string, sizeof(string), "* You have been charged {F5F5F5}$%d{A4A4A4} for having a business.", 5 * 15 * PlayerInfo[i][pLevel]);
				    SendClientMessage(i, COLOR_GREY, string);
				}
				idx = PlayerInfo[i][pHouse];
				if(PlayerInfo[i][pHouse])
				{
				    format(string, sizeof(string), "* You have been charged {F5F5F5}$%d{A4A4A4} for having a house.", HouseInfo[idx][hLevel] * PlayerInfo[i][pLevel]);
				    SendClientMessage(i, COLOR_GREY, string);
				}
				if(PlayerInfo[i][pVIP] == 2) SendClientMessage(i, COLOR_VIP, "* Silver VIP: Your paycheck was 25 percent higher than usual.");
				else if(PlayerInfo[i][pVIP] == 3) SendClientMessage(i, COLOR_VIP, "* Gold VIP: Your paycheck was 50 percent higher than usual.");
				else if(PlayerInfo[i][pVIP] == 4) SendClientMessage(i, COLOR_VIP, "* Platinum VIP: Your paycheck was 100 percent higher than usual.");
				// Clearing Playing Minutes
	    		PlayerInfo[i][pMinutes] = 0;
	    	/*	// Giving a reward point
	    		if(!PlayerInfo[i][pVIP])
	    		{
		    		PlayerInfo[i][pReward] ++;
		    		if(PlayerInfo[i][pReward] >= 2124)
		    		{
						PlayerInfo[i][pReward] = 0;
						PlayerInfo[i][pVIP] = 1;
						PlayerInfo[i][pVIPTemp] = 60*24;
						format(string, sizeof(string), "RewardWarn: %s has been rewarded a Bronze VIP package for 24 hours for being active.", RPN(i));
						SendClientMessageToAll(COLOR_VIP, string);
						Log("logs/makevip.log", string);
						SendClientMessage(i, COLOR_GREY, " You will not be rewarded again until your Bronze VIP reward time is over.");
		    		}
		    		else
		    		{
						format(string, sizeof(string), "* You have gained an activity point, you have total of %d points.", PlayerInfo[i][pReward]);
						SendClientMessage(i, COLOR_VIP, string);
		    		}
	    		}*/
	    		// Loyal Points
	    		if(PlayerInfo[i][pVIP])
	    		{
	    		    PlayerInfo[i][pLPoints] ++;
   					format(string, sizeof(string), "* You have gained a VIP point, you have total of %d points.", PlayerInfo[i][pLPoints]);
	    		    SendClientMessage(i, COLOR_GREEN, string);
	    		}
    		}
    		else
			{
			    SendClientMessage(i, COLOR_RESTART, " You haven't played long enough to recieve a paycheck.");
			}
			PayChecks = 1;
			SetTimer("PayCheckDone", 5000, false);
		}
    }
	return 1;
}
Reply
#2

pawn Код:
new savings;
savings = floatround(money * 0.01, floatround_ceil);
// add the savings to the paycheck
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)