SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 30/01/2010, 01:33 AM   #1
Perker12345
Big Clucker
 
Join Date: Jan 2010
Posts: 96
Reputation: 0
Default Payday, minor help.

Hi i tried a few things to increase my payday for a couple of jobs.
how can i do that if(PlayerInfo[playerid][pJob] == 3) then it would add an extra 1000 cash onto the payday, and if(PlayerInfo[playerid][pJob] == 4) it would add 1500$ it might be very easy but heh.. Not for me :d please help
pawn Code:
public PayDay()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
          if(gPlayerLogged[i] == 1)
          {
                if(PlayerInfo[i][pAllowedPayday] >= 5)
                {
                        new wstring[256];
                        new randcheck = 1299 + random(3799);
                        new interest = (PlayerInfo[i][pBank]/1000)*(intrate);
                        new bonus = PlayerInfo[i][pPayCheck];
                      new newbank = PlayerInfo[i][pBank] + interest;
                    new randtax = 20 + random(50);
                        SendClientMessage(i,COLOR_RED,"|____________________PayDay____________________|");
                        format(wstring, sizeof(wstring), "~y~PayDay~n~~w~Paycheck: ~g~%d",randcheck + bonus);
                        GameTextForPlayer(i, wstring, 5000, 1);
                      format(wstring, sizeof(wstring), "PayCheck: $%d, Bonus: $%d", randcheck, bonus);
                      SendClientMessage(i,COLOR_WHITE, wstring);
                      format(wstring, sizeof(wstring), "Balance: $%d, Interest Gained: $%d, New Balance: $%d,", PlayerInfo[i][pBank], interest, newbank);
                      format(wstring, sizeof(wstring), "Interest Rate: 0.%d percent", intrate);
                      SendClientMessage(i,COLOR_WHITE, wstring);
                      format(wstring, sizeof(wstring), "Government Taxes: $%d", randtax);
                      SendClientMessage(i,COLOR_WHITE, wstring);
                      PlayerInfo[i][pBank] += interest;
                      PlayerInfo[i][pBank] -= randtax;
                      PlayerInfo[i][pBank] += randcheck + bonus;
                    PlayerInfo[i][pPayCheck] = 0;
                        PlayerInfo[i][pAllowedPayday] = 0;
                        PlayerInfo[i][pExp]++;
                        PlayerInfo[i][pPlayingHours] += 1;
                        SendClientMessage(i,COLOR_RED,"________________________________________________");

                        new nxtlevel = PlayerInfo[i][pLevel]+1;
                        new expamount = nxtlevel*levelexp;
                        if(PlayerInfo[i][pExp] < expamount)
                        {
                            format(wstring, sizeof(wstring), "%d/%d experience needed to level up, you currently have %d", expamount,expamount,PlayerInfo[i][pExp]);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                        }
                        else
                        {
                            format(wstring, sizeof(wstring), "Level up! - New Level: %d", nxtlevel);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                            PlayerInfo[i][pLevel]++;
                          PlayerInfo[i][pExp] = 0;
                        }
                }
                else
                {
                    SendClientMessage(i,COLOR_WHITE,"[Info] Payday not received, not played long enough");
                }
            }
            else
            {
                SendClientMessage(i,COLOR_WHITE,"[Info] You are not logged in, payday not received");
            }
        }
    }
}
Perker12345 is offline  
Old 30/01/2010, 03:37 AM   #2
AcId n RaPiD
Big Clucker
 
Join Date: Jul 2009
Posts: 167
Reputation: -1
Default Re: Payday, minor help.

Here ya' go. Try it out and tell me if it works.

pawn Code:
public PayDay()
{
  for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
          if(gPlayerLogged[i] == 1)
          {
            if(PlayerInfo[i][pAllowedPayday] >= 5)
            {
                    if(PlayerInfo[playerid][pJob] == 0)
                    {
                            new wstring[256];
                            new randcheck = 1299 + random(1500);
                            new interest = (PlayerInfo[i][pBank]/1000)*(intrate);
                            new bonus = PlayerInfo[i][pPayCheck];
                          new newbank = PlayerInfo[i][pBank] + interest;
                        new randtax = 20 + random(50);
                            SendClientMessage(i,COLOR_LIGHTGREEN,"____________________[PayDay]____________________");
                            format(wstring, sizeof(wstring), "~y~PayDay~n~~w~Paycheck: ~g~%d",randcheck + bonus);
                            GameTextForPlayer(i, wstring, 5000, 1);
                          format(wstring, sizeof(wstring), "PayCheck: $%d, Bonus: $%d", randcheck, bonus);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                          format(wstring, sizeof(wstring), "Balance: $%d, Interest Gained: $%d, New Balance: $%d, Interest Rate: 0.%d percent", PlayerInfo[i][pBank], interest, newbank,intrate);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                          format(wstring, sizeof(wstring), "Government Taxes: $%d", randtax);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                          PlayerInfo[i][pBank] += interest;
                          PlayerInfo[i][pBank] -= randtax;
                          PlayerInfo[i][pBank] += randcheck + bonus;
                        PlayerInfo[i][pPayCheck] = 0;
                            PlayerInfo[i][pAllowedPayday] = 0;
                            PlayerInfo[i][pExp]++;
                            PlayerInfo[i][pPlayingHours] += 1;
                            SendClientMessage(i,COLOR_WHITE, "[Info:] Your money is now available to pickup at the bank");
                            SendClientMessage(i,COLOR_LIGHTGREEN,"______________________________________________________________________________________");

                            new nxtlevel = PlayerInfo[i][pLevel]+1;
                            new expamount = nxtlevel*levelexp;
                            if(PlayerInfo[i][pExp] < expamount)
                            {
                                format(wstring, sizeof(wstring), "You need %d/%d experience, you currently have %d", expamount,expamount,PlayerInfo[i][pExp]);
                              SendClientMessage(i,COLOR_WHITE, wstring);
                            }
                            else
                            {
                                format(wstring, sizeof(wstring), "You leveled up! - New Level: %d", nxtlevel);
                              SendClientMessage(i,COLOR_WHITE, wstring);
                                PlayerInfo[i][pLevel]++;
                                format(wstring, sizeof(wstring), "Your new target is %d/%d experience points", expamount,expamount);
                              SendClientMessage(i,COLOR_WHITE, wstring);
                              PlayerInfo[i][pExp] = 0;
                            }
                    }
            else if(PlayerInfo[playerid][pJob] >= 1)
                    {
                            new wstring[256];
                            new randcheck = 1500 + random(3799);
                            new interest = (PlayerInfo[i][pBank]/1000)*(intrate);
                            new bonus = PlayerInfo[i][pPayCheck];
                          new newbank = PlayerInfo[i][pBank] + interest;
                        new randtax = 20 + random(50);
                            SendClientMessage(i,COLOR_LIGHTGREEN,"____________________[PayDay]____________________");
                            format(wstring, sizeof(wstring), "~y~PayDay~n~~w~Paycheck: ~g~%d",randcheck + bonus);
                            GameTextForPlayer(i, wstring, 5000, 1);
                          format(wstring, sizeof(wstring), "PayCheck: $%d, Bonus: $%d", randcheck, bonus);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                          format(wstring, sizeof(wstring), "Balance: $%d, Interest Gained: $%d, New Balance: $%d, Interest Rate: 0.%d percent", PlayerInfo[i][pBank], interest, newbank,intrate);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                          format(wstring, sizeof(wstring), "Government Taxes: $%d", randtax);
                          SendClientMessage(i,COLOR_WHITE, wstring);
                          PlayerInfo[i][pBank] += interest;
                          PlayerInfo[i][pBank] -= randtax;
                          PlayerInfo[i][pBank] += randcheck + bonus;
                        PlayerInfo[i][pPayCheck] = 0;
                            PlayerInfo[i][pAllowedPayday] = 0;
                            PlayerInfo[i][pExp]++;
                            PlayerInfo[i][pPlayingHours] += 1;
                            SendClientMessage(i,COLOR_WHITE, "[Info:] Your money is now available to pickup at the bank");
                            SendClientMessage(i,COLOR_LIGHTGREEN,"______________________________________________________________________________________");

                            new nxtlevel = PlayerInfo[i][pLevel]+1;
                            new expamount = nxtlevel*levelexp;
                            if(PlayerInfo[i][pExp] < expamount)
                            {
                                format(wstring, sizeof(wstring), "You need %d/%d experience, you currently have %d", expamount,expamount,PlayerInfo[i][pExp]);
                              SendClientMessage(i,COLOR_WHITE, wstring);
                            }
                            else
                            {
                                format(wstring, sizeof(wstring), "You leveled up! - New Level: %d", nxtlevel);
                              SendClientMessage(i,COLOR_WHITE, wstring);
                                PlayerInfo[i][pLevel]++;
                                format(wstring, sizeof(wstring), "Your new target is %d/%d experience points", expamount,expamount);
                              SendClientMessage(i,COLOR_WHITE, wstring);
                              PlayerInfo[i][pExp] = 0;
                            }
                    }
                }
                else
                {
                    SendClientMessage(i,COLOR_WHITE,"[Info:] Payday not received, not played long enough");
                }
            }
            else
            {
                SendClientMessage(i,COLOR_WHITE,"[Info:] You are not logged in, payday not received");
            }
        }
    }
}
AcId n RaPiD is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Very minor countdown problem [XST]O_x Help Archive 2 10/07/2010 03:58 PM
Minor Problem Please Help Typical_Cat Help Archive 2 27/04/2010 08:08 AM
Minor Question Torran Everything and Nothing 1 10/04/2010 11:12 AM
Minor problem Desert Help Archive 4 17/03/2010 06:24 PM
[NPC] Minor problem with my npc Pawno_Master Help Archive 5 25/10/2009 07:05 AM


All times are GMT. The time now is 08:14 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.