PayDay help
#1

Hello guys, how can I lower the time a player has to be online to obtain a payday.
For example, if a player is connected for 20 minutes before payday he will obtain it.

Now i think it's set to 60 minutes and it's hard to get it.

I want the payday to start at :00 each hour but i want to lower the time the player has to be online before payday to obtain it.

Hope you understand what i'm trying to say, sorry for my bad english.


PHP код:
function PayDay()
{
    new 
string[128];
    new 
account,interest;
    new 
rent 0;
    foreach(
Playeri)
    {
        if(
PlayerData[i][pLevel] > 0)
        {
            new 
playername2[MAX_PLAYER_NAME];
            
GetPlayerName(iplayername2sizeof(playername2));
            
account PlayerData[i][pAccount];
            new 
key PlayerData[i][pPhousekey];
            if(
key != 255)
            {
                
rent HouseInfo[key][hRent];
                if(
strcmp(playername2HouseInfo[key][hOwner], true) == 0)
                {
                    
rent 0;
                }
                else if(
rent GetPlayerCash(i))
                {
                    
PlayerData[i][pPhousekey] = 255;
                    
SendClientMessage(iCOLOR_WHITE"You have been evicted.");
                    
rent 0;
                    new 
wakaname[25];
                    
GetPlayerName(i,wakaname,25);
                    new 
str[128];
                    
format(str,128,"UPDATE `users` SET `House`='%d' WHERE `name`='%s'",PlayerData[i][pPhousekey],wakaname);
                    
mysql_query(str);
                }
                
HouseInfo[key][hTakings] = HouseInfo[key][hTakings]+rent;
            }
            new 
tmpintrate;
            if (
key != 255 && strcmp(playername2HouseInfo[key][hOwner], true) == 0)
            {
                if(
PlayerData[i][pDonateRank] > 0) { tmpintrate intrate+4; }
                else { 
tmpintrate intrate+2; }
            }
            else
            {
                if(
PlayerData[i][pDonateRank] > 0) { tmpintrate 3; }
                else { 
tmpintrate 1; }
            }
            if(
PlayerData[i][pPayDay] >= 3)
            {
                
Tax += TaxValue;
                
PlayerData[i][pAccount] -= TaxValue;
                new 
wakaname[25];
                
GetPlayerName(i,wakaname,25);
                new 
str[128];
                
format(str,128,"UPDATE `users` SET `Bank`='%d' WHERE `name`='%s'",PlayerData[i][pAccount],wakaname);
                
mysql_query(str);
                new 
checks PlayerData[i][pPayCheck] / 5;
                if(
PlayerData[i][pDonateRank] > 0)
                {
                    new 
bonus PlayerData[i][pPayCheck] / 10;
                    
checks += bonus;
                    new 
wakaname1[25];
                    
GetPlayerName(i,wakaname1,25);
                    new 
str1[128];
                    
format(str,128,"UPDATE `users` SET `PayCheck`='%d' WHERE `name`='%s'",PlayerData[i][pPayCheck],wakaname1);
                    
mysql_query(str1);
                }
                new 
ebill = (PlayerData[i][pAccount]/10000)*(PlayerData[i][pLevel]);
                
ConsumingMoney[i] = 1;
                
GivePlayerCash(ichecks);
                if(
PlayerData[i][pAccount] > 0)
                {
                    
PlayerData[i][pAccount] -= ebill;
                    
SBizzInfo[4][sbTill] += ebill;
                    new 
wakaname1[25];
                    
GetPlayerName(i,wakaname1,25);
                    new 
str1[128];
                    
format(str1,128,"UPDATE `users` SET `Bank`='%d' WHERE `name`='%s'",PlayerData[i][pAccount],wakaname1);
                    
mysql_query(str1);
                    
                    new
                        
Query 256 ] ;
                    
format(Query,256,"UPDATE `sbizz` SET `Till`='%d' WHERE `ID`='4'",SBizzInfo[4][sbTill]);
                    
mysql_query(Query);
                }
                else
                {
                    
ebill 0;
                }
                
interest = (PlayerData[i][pAccount]/1000)*(tmpintrate);
                
PlayerData[i][pExp]++;
                new 
wakaname2[25];
                
GetPlayerName(i,wakaname2,25);
                new 
str2[128];
                
format(str2,128,"UPDATE `users` SET `Respect`='%d',`Money`='%d' WHERE `name`='%s'",PlayerData[i][pExp],GetPlayerCash(i),wakaname2);
                
mysql_query(str2);
                
PlayerPlayMusic(i);
                
PlayerData[i][pAccount] = account+interest;
                
SendClientMessage(iCOLOR_GREEN"|___ BANK STATMENT ___|");
                
format(stringsizeof(string), "  Paycheck: $%d   Tax Money: -$%d"checksTaxValue);
                
SendClientMessage(iCOLOR_WHITEstring);
                if(
PlayerData[i][pPhousekey] != 255 || PlayerData[i][pPbiskey] != 255)
                {
                    
format(stringsizeof(string), "  Electricity Bill: -$%d"ebill);
                    
SendClientMessage(iCOLOR_GRAD1string);
                }
                
format(stringsizeof(string), "  Balance: $%d"account checks);
                
SendClientMessage(iCOLOR_WHITEstring);
                
format(stringsizeof(string), "  Interest Rate: 0.%d percent",tmpintrate);
                
SendClientMessage(iCOLOR_GRAD2string);
                
format(stringsizeof(string), "  Interest Gained $%d"interest);
                
SendClientMessage(iCOLOR_GRAD3string);
                
SendClientMessage(iCOLOR_GREEN"|--------------------------------------|");
                
format(stringsizeof(string), "  New Balance: $%d"PlayerData[i][pAccount]);
                
SendClientMessage(iCOLOR_GRAD5string);
                
format(stringsizeof(string), "  Rent: -$%d"rent);
                
SendClientMessage(iCOLOR_GRAD5string);
                
format(stringsizeof(string), "~y~PayDay~n~~w~Paycheck");
                
GameTextForPlayer(istring50001);
                
rent 0;
                
PlayerData[i][pPayDay] = 0;
                
PlayerData[i][pPayCheck] = 0;
                
PlayerData[i][pConnectTime] += 1;
                new 
wakaname3[25];
                
GetPlayerName(i,wakaname3,25);
                new 
str3[512];
                
format(str3,512,"UPDATE `users` SET `Bank`='%d',`PayDay`='0',`PayCheck`='0',`ConnectedTime`='%d' WHERE `name`='%s'",PlayerData[i][pAccount],PlayerData[i][pConnectTime],wakaname3);
                
mysql_query(str3);
                if(
PlayerData[i][pDonateRank] > 0)
                {
                    
PlayerData[i][pPayDayHad] += 1;
                    if(
PlayerData[i][pPayDayHad] >= 5)
                    {
                        
PlayerData[i][pExp]++;
                        
PlayerData[i][pPayDayHad] = 0;
                        new 
wakaname1[25];
                        
GetPlayerName(i,wakaname1,25);
                        new 
str1[128];
                        
format(str1,128,"UPDATE `users` SET `Respect`='%d',`PayDayHad`='0' WHERE `name`='%s'",PlayerData[i][pExp],wakaname1);
                        
mysql_query(str1);
                    }
                }
                if(
PlayerData[i][pMember] == 10 || PlayerData[i][pLeader] == 10)
                {
                    
PlayerData[i][pTow] += 5;
                    new 
wakaname1[25];
                    
GetPlayerName(i,wakaname1,25);
                    new 
str1[128];
                    
format(str1,128,"UPDATE `users` SET `Tow`='%d' WHERE `name`='%s'",PlayerData[i][pTow],wakaname1);
                    
mysql_query(str1);
                  }
                if(
PlayerData[i][pRob] <= 50)
                {
                    
PlayerData[i][pRob] += 1;
                    new 
wakaname1[25];
                    
GetPlayerName(i,wakaname1,25);
                    new 
str1[128];
                    
format(str1,128,"UPDATE `users` SET `Rob`='%d' WHERE `name`='%s'",PlayerData[i][pTow],wakaname1);
                    
mysql_query(str1);
                  }
                  if(
PlayerData[i][pMember] == || PlayerData[i][pLeader] == 0)
                {
                    
PlayerData[i][pDriverSus] -= 1;
                    new 
wakaname1[25];
                    
GetPlayerName(i,wakaname1,25);
                    new 
str1[128];
                    
format(str1,128,"UPDATE `users` SET `Suspend`='%d' WHERE `name`='%s'",PlayerData[i][pDriverSus],wakaname1);
                    
mysql_query(str1);
                  }
                  if(
PlayerData[i][pImprumut] > 1)
                {
                       new 
imprumutl floatround(PlayerData[i][pImprumut] / 4);
                       if(
imprumutl == 0)
                       {
                           
GivePlayerCash(i, -PlayerData[i][pImprumut]);
                           
PlayerData[i][pImprumut]=0;
                           new 
wakaname1[25];
                        
GetPlayerName(i,wakaname1,25);
                        new 
str1[128];
                        
format(str1,128,"UPDATE `users` SET `Imprumut`='0',`Money`='%d' WHERE `name`='%s'",GetPlayerCash(i),wakaname1);
                        
mysql_query(str1);
                       }else
                       {
                           
GivePlayerCash(i, -imprumutl);
                           
PlayerData[i][pImprumut] -= imprumutl;
                           new 
wakaname1[25];
                        
GetPlayerName(i,wakaname1,25);
                        new 
str1[128];
                        
format(str1,128,"UPDATE `users` SET `Imprumut`='%d',`Money`='%d' WHERE `name`='%s'",PlayerData[i][pImprumut],GetPlayerCash(i),wakaname1);
                        
mysql_query(str1);
                       }
                       
                       if(
PlayerData[i][pImprumut] <=1)
                       {
                        
PlayerData[i][pImprumut] = 0;
                        new 
wakaname1[25];
                        
GetPlayerName(i,wakaname1,25);
                        new 
str1[128];
                        
format(str1,128,"UPDATE `users` SET `Imprumut`='0' WHERE `name`='%s'",wakaname1);
                        
mysql_query(str1);
                        
SendClientMessage(i,COLOR_GRAD5,"  You have finsihed paying your loan.");
                       }else{
                           
format(string,sizeof(string),"  You've payed %d$ of the loan. You still have %d$ to pay.",imprumutlPlayerData[i][pImprumut]);
                           
SendClientMessage(i,COLOR_GRAD5,string);
                       }
                }
            }
            else
            {
                
SendClientMessage(iCOLOR_RED"* You haven't played long enough to obtain a PayDay.");
            }
        }
    }
    
Checkprop();
    return 
1;

Reply
#2

any idea?
Reply
#3

We can't help you change the timer if we can't see it. We need to see the code where the PayDay function is actually being called.
Reply
#4

I know the script you're using. Use CTRL + F and paste this code:

pawn Код:
productiontimer = SetTimer("Production", 900000, 1); //15 mins (900000)
Change value (900000) to a 1200000 (20 minutes, as you wanted above).

CTRL + F again and type this:

pawn Код:
function Production()
Scroll down a little until you find this line:

pawn Код:
if(PlayerData[i][pPayDay] < 4)
And change the < 4 to < 1

pawn Код:
if(PlayerData[i][pPayDay] < 1)
And it should work. My apologies if it's not the same script, I only assumed this as the PayDay function is pretty much identical to the script I'm viewing right now.
Reply
#5

I did the changes as it was the gamemode you were looking at but it didn't work at all.

Let me explain what I want one more time.

Now, to get a payday a player must be online from let's say 11:00 to 12:00 (full 60 minutes). If it's even 1 minute missing from those 60, he wouldn't get the payday.

What I want to do is: the player must be online from at least 11:45 to 12:00 to get the payday. So if he logs in at 11:45 or before, he will still get the payday but if he logs in at 11:46 we won't get it.
Reply
#6

Anybody? Please?!
Reply
#7

You can get the time when player enter in server and check if player played enough time.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)