Payday system not working
#1

Hi.

Some of the faction ranks dont earn a sallary. Could one of you try and see the problem please?
Код:
public Payday()
{
     //random pay MAX: $40,000

    new string[128], string2[128];
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
	    new payday = PlayerInfo[i][pBank] * 3/100;
	    new factionpay = random(30000);
	    new factionpay6 = random(100000) + 50000;
		new tax = payday + factionpay * 3/100;
		new tax2 = payday * 3/100;
		new total = payday + factionpay - tax;
		new total2= payday - tax2;
		new factotal1 = factionpay6 - tax2;
		new factotal2 = factotal1 + payday;

    	if(IsPlayerConnected(i))
    	{

		    format(string,sizeof(string),"~b~Payday: ~p~$%d", payday);
		    GameTextForAll(string, 5000, 5);
		    SendClientMessage(i, -1, "=====================Payday========================");
		    if(PlayerInfo[i][pFaction] == 1)
			{
   				if(PlayerInfo[i][pFacRank] == 1)
		        {
		            new string3[128], str4[128], str5[128];
	             //   new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 2)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 3)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 4)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 5)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 6)
		        {
		            new string3[128], str4[128], str5[128], str6[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factotal2);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			format(str6, sizeof(str6), "New account balance: $%d", PlayerInfo[i][pBank]);
		   			SendClientMessage(i, -1, str6);
		   			PlayerInfo[i][pBank] += factotal2;
		        }
		        else if(PlayerInfo[i][pFacLeader] == 1)
		        {

		        }
	    	}
	    	else if(PlayerInfo[i][pFaction] == 3)
	    	{
	        	if(PlayerInfo[i][pFacRank] == 1)
	        	{
		            new string3[128], str4[128], str5[128];
	             //   new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
	        	}
		        else if(PlayerInfo[i][pFacRank] == 2)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
	        	}
		        else if(PlayerInfo[i][pFacRank] == 3)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 4)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 5)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 6)
		        {
		            new string3[128], str4[128], str5[128], str6[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factotal2);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			format(str6, sizeof(str6), "New account balance: $%d", PlayerInfo[i][pBank]);
		   			SendClientMessage(i, -1, str6);
		   			PlayerInfo[i][pBank] += factotal2;
		        }
	    	}
			else if(PlayerInfo[i][pFaction] == 6)
		    {
		        if(PlayerInfo[i][pFacRank] == 1)
		        {
		            new string3[128], str4[128], str5[128];
	             //   new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 2)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 3)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 4)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 5)
		        {
		            new string3[128], str4[128], str5[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factionpay);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			PlayerInfo[i][pBank] += total;
		        }
		        else if(PlayerInfo[i][pFacRank] == 6)
		        {
		            new string3[128], str4[128], str5[128], str6[128];
	           //     new factionpay = random(30000);
					format(string3, sizeof(string3), "Salary: $%d", factotal2);
					SendClientMessage(i, -1, string3);
					format(str5, sizeof(str5), "Taxes: $%d", tax);
					SendClientMessage(i, -1, str5);
					format(string2, sizeof(string2), "Your paycheck: $%d", payday);
					SendClientMessage(i, -1, string2);
					SendClientMessage(i, -1, "--------------------------------");
		   			format(str4, sizeof(str4), "Total payday: $%d", total);
		   			SendClientMessage(i, -1, str4);
		   			format(str6, sizeof(str6), "New account balance: $%d", PlayerInfo[i][pBank]);
		   			SendClientMessage(i, -1, str6);
		   			PlayerInfo[i][pBank] += factotal2;
		        }
	    	}
	    	else
	    	{
		        new str3[128], str4[128];
	        //    new factionpay = random(30000);
		    	format(string2, sizeof(string2), "Your paycheck: $%d", payday);
		    	SendClientMessage(i, -1, string2);
		    	format(str3, sizeof(str3), "Taxes: $%d", tax2);
		        SendClientMessage(i, -1, str3);
		    	SendClientMessage(i, -1, "--------------------------------");
		    	format(str4, sizeof(str4), "Total: $%d", total2);
		    	SendClientMessage(i, -1, str4);
		    	PlayerInfo[i][pBank] += total;
	    	}
	    	SendClientMessage(i, -1, "---------------------------------------------------");
   		}
	}
    return 1;
}
Thanks +rep
Reply
#2

Bump!
Reply
#3

I don't understand your problem explain more please , and why you used to check each player rank 'pFacRank' and used them by spaming and many useless function not used ,you can simply use this
pawn Код:
public Payday()
{
     //random pay MAX: $40,000

    new string[128], string2[128];
    new payday = PlayerInfo[i][pBank] * 3/100;
    new factionpay = random(30000);
    new factionpay6 = random(100000) + 50000;
    new tax = payday + factionpay * 3/100;
    new tax2 = payday * 3/100;
    new total = payday + factionpay - tax;
    new total2= payday - tax2;
    new factotal1 = factionpay6 - tax2;
    new factotal2 = factotal1 + payday;
    for(new i = 0; i < MAX_PLAYERS; i++)
   {
        if(IsPlayerConnected(i))
        {

            format(string,sizeof(string),"~b~Payday: ~p~$%d", payday);
            GameTextForAll(string, 5000, 5);
            SendClientMessage(i, -1, "=====================Payday========================");
            if(PlayerInfo[i][pFaction] == 1)
            {
                if(PlayerInfo[i][pFacRank] >= 1)
                {
                    new string3[128], str4[128], str5[128];
                 //   new factionpay = random(30000);
                    format(string3, sizeof(string3), "Salary: $%d", factionpay);
                    SendClientMessage(i, -1, string3);
                    format(str5, sizeof(str5), "Taxes: $%d", tax);
                    SendClientMessage(i, -1, str5);
                    format(string2, sizeof(string2), "Your paycheck: $%d", payday);
                    SendClientMessage(i, -1, string2);
                    SendClientMessage(i, -1, "--------------------------------");
                    format(str4, sizeof(str4), "Total payday: $%d", total);
                    SendClientMessage(i, -1, str4);
                    PlayerInfo[i][pBank] += total;
                }
            }
            else
            {
                new str3[128], str4[128];
            //    new factionpay = random(30000);
                format(string2, sizeof(string2), "Your paycheck: $%d", payday);
                SendClientMessage(i, -1, string2);
                format(str3, sizeof(str3), "Taxes: $%d", tax2);
                SendClientMessage(i, -1, str3);
                SendClientMessage(i, -1, "--------------------------------");
                format(str4, sizeof(str4), "Total: $%d", total2);
                SendClientMessage(i, -1, str4);
                PlayerInfo[i][pBank] += total;
            }
            SendClientMessage(i, -1, "---------------------------------------------------");
        }
    }
    return 1;
}
Reply
#4

I need the "Salary" to be bigger the higher your rank is... If that makes sense. The problem I am having is that not all the ranks are getting a salary. if that makes sense. The only people that get a salary are Rank6 and someone that is not in a faction. Make sense?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)