PDA

View Full Version : Taxes


sscarface
28/07/2015, 10:57 PM
Hi, How can i script like if a player join and after 20 mins player should get this

i added it in my ways but it counts all players as same time. It should count if a player joined the server and count player time after 20mins it should give. Did u get guys? Help me!

//Interest
if(pData[i][pBankMoney] > 0)
{
new interest = pData[i][pBankMoney]/64;//1.5%
pData[i][pBankMoney] = pData[i][pBankMoney] + interest;
format(string, sizeof(string), "[Interest]: You have gained $%d in bank interest.", interest);
SendClientMessage(i, GREEN, string);
}

IstuntmanI
28/07/2015, 11:06 PM
Use a timer set to repeated at an interval of 20 minutes, when the player connects:
new giBankInterestTimer[ MAX_PLAYERS ];

public OnPlayerConnect( playerid )
{
giBankInterestTimer[ playerid ] = SetTimerEx( "IncreaseBankInterest", 1000 * 60 * 20, 1 /*Use 0 if you want to increase it only once*/, "i", playerid );
return 1;
}

public OnPlayerDisconnect( playerid, reason )
{
KillTimer( giBankInterestTimer[ playerid ] );
return 1;
}

forward IncreaseBankInterest( playerid );
public IncreaseBankInterest( playerid )
{
//Interest
if(pData[playerid][pBankMoney] > 0)
{
new interest = pData[playerid][pBankMoney]/64;//1.5%
pData[playerid][pBankMoney] = pData[playerid][pBankMoney] + interest;
format(string, sizeof(string), "[Interest]: You have gained $%d in bank interest.", interest);
SendClientMessage(playerid, GREEN, string);
}
return 1;
}

sscarface
29/07/2015, 12:07 AM
Didn't work dude.