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.
PHP код:
function PayDay()
{
new string[128];
new account,interest;
new rent = 0;
foreach(Player, i)
{
if(PlayerData[i][pLevel] > 0)
{
new playername2[MAX_PLAYER_NAME];
GetPlayerName(i, playername2, sizeof(playername2));
account = PlayerData[i][pAccount];
new key = PlayerData[i][pPhousekey];
if(key != 255)
{
rent = HouseInfo[key][hRent];
if(strcmp(playername2, HouseInfo[key][hOwner], true) == 0)
{
rent = 0;
}
else if(rent > GetPlayerCash(i))
{
PlayerData[i][pPhousekey] = 255;
SendClientMessage(i, COLOR_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(playername2, HouseInfo[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(i, checks);
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(i, COLOR_GREEN, "|___ BANK STATMENT ___|");
format(string, sizeof(string), " Paycheck: $%d Tax Money: -$%d", checks, TaxValue);
SendClientMessage(i, COLOR_WHITE, string);
if(PlayerData[i][pPhousekey] != 255 || PlayerData[i][pPbiskey] != 255)
{
format(string, sizeof(string), " Electricity Bill: -$%d", ebill);
SendClientMessage(i, COLOR_GRAD1, string);
}
format(string, sizeof(string), " Balance: $%d", account - checks);
SendClientMessage(i, COLOR_WHITE, string);
format(string, sizeof(string), " Interest Rate: 0.%d percent",tmpintrate);
SendClientMessage(i, COLOR_GRAD2, string);
format(string, sizeof(string), " Interest Gained $%d", interest);
SendClientMessage(i, COLOR_GRAD3, string);
SendClientMessage(i, COLOR_GREEN, "|--------------------------------------|");
format(string, sizeof(string), " New Balance: $%d", PlayerData[i][pAccount]);
SendClientMessage(i, COLOR_GRAD5, string);
format(string, sizeof(string), " Rent: -$%d", rent);
SendClientMessage(i, COLOR_GRAD5, string);
format(string, sizeof(string), "~y~PayDay~n~~w~Paycheck");
GameTextForPlayer(i, string, 5000, 1);
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] == 0 || 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.",imprumutl, PlayerData[i][pImprumut]);
SendClientMessage(i,COLOR_GRAD5,string);
}
}
}
else
{
SendClientMessage(i, COLOR_RED, "* You haven't played long enough to obtain a PayDay.");
}
}
}
Checkprop();
return 1;
}
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.
I know the script you're using. Use CTRL + F and paste this code:
Change value (900000) to a 1200000 (20 minutes, as you wanted above).
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.
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.
You can get the time when player enter in server and check if player played enough time.