#1

Here is the current code I have. I was wondering if you could add it so it takes my savings then multiplies it by 0.5 and will go directly to my savings account

Код 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

You need to learn to script, and not ask people to simply make what you want.

Whoever throws up code to try and "help" this guy should get slammed by everyone.
Reply
#3

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
You need to learn to script, and not ask people to simply make what you want.

Whoever throws up code to try and "help" this guy should get slammed by everyone.
Well I need help. You don't just "learn things", someone has to tell you how to do it.
Reply
#4

Quote:
Originally Posted by boy
Посмотреть сообщение
Well I need help. You don't just "learn things", someone has to tell you how to do it.
There's the wiki... Posting up your code and asking someone to do it, isn't teaching you anything...


http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf

http://wiki.sa-mp.com

https://sampwiki.blast.hk/wiki/PAWN_for_Begginers



We don't need to tell you anything, all the information you need is out there by simply searching and reading...

Go learn, don't rely on others to simply post up code for you.


And it's not as if you're actually looking for help finding an error in your code or anything, you're BLATANTLY posting up your code and asking something to be added to it, which really isn't "help", it's more you being lazy, not doing it, and expecting someone else to be a fool and to just do it.



And furthermore, if you have such a script, yet can't add this in, how are you going to last without having to ask everyone to do everything for you if you can't even add %50 to a value?

Seriously, that's so basic, that it's offensive that you even ask in this section to make that...
Reply
#5

You're being incredibly ignorant. I already scripted in the command, got two errors, fixed them both, then when I went to test it in-game it gave me a terribly high number into my savings. Please leave if you're not going to help me. Seriously.
Reply
#6

show the code
Reply
#7

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
show the code
The code is in the original post.
Reply
#8

Quote:
Originally Posted by boy
Посмотреть сообщение
You're being incredibly ignorant. I already scripted in the command, got two errors, fixed them both, then when I went to test it in-game it gave me a terribly high number into my savings. Please leave if you're not going to help me. Seriously.
Sounds like we got Michael Jackson here.

Funny that this isn't actually a command now isn't it...

Quote:
Originally Posted by UltraScripter
Посмотреть сообщение
show the code
As I said, if you help them, you should be publicly slammed.

Quote:
Originally Posted by boy
Посмотреть сообщение
The code is in the original post.
Again, helping you do this, isn't what scripting help is for...


You should be able to add 50% to any value EASILY... Yet obviously you've been handed too many fixes in the past to actually code...


LEARN rather than asking people to "fix"...





If you run this, it will do this

Код:
else
			{
			    SendClientMessage(i, COLOR_RESTART, " You haven't played long enough to recieve a paycheck.");
			}
			PayChecks = 1;
			SetTimer("PayCheckDone", 5000, false);
Is it really needed to SetTimer for each player?

There's so much questionable in your code you'd almost be better re-writing it again.

Код:
	new bonus;
	foreach(Player, i)
	{
	    if(IsPlayerLoggedIn(i)) bonus ++;
	}
	bonus = bonus*2;
Each time that runs through it will add 1 to the bonus, but then multiply that by 2.

So say we've spent 5 hours on your server, it's going to make 2 for the first hour.

Second hour that variable will end up being 6

third it will be 14

fourth will be 30

fifth will be 62.

and

Код:
finalpaycheck = finalpaycheck + ((bonus/100)*finalpaycheck);
You need to look at your code and make it easier for you, to understand...
Reply
#9

i can't figure out why you're so mad. do you need something from me or what?
Reply
#10

Quote:
Originally Posted by boy
Посмотреть сообщение
i can't figure out why you're so mad. do you need something from me or what?
You're in here, asking for someone to fix your code, and simply wanting it done.


The first statment you make in here is no mention of any errors or problems, just a straight up "Here is the current code I have. I was wondering if you could add it so it takes my savings then multiplies it by 0.5 and will go directly to my savings account"


Like that's saying ANYTHING about the situation, and not just asking for a feature to be added to your code.



Nothing "mad" about it, Learn to code, and if you know how to code yet can't read your own, then get some glasses, a proper light, and READ MORE...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)