SA-MP Forums Archive
Taxes - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Taxes (/showthread.php?tid=583521)



Taxes - sscarface - 28.07.2015

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!
PHP код:
//Interest
              
if(pData[i][pBankMoney] > 0)
                {
                  new 
interest pData[i][pBankMoney]/64;//1.5%
                     
pData[i][pBankMoney] = pData[i][pBankMoney] + interest;
                  
format(stringsizeof(string), "[Interest]: You have gained $%d in bank interest."interest);
                  
SendClientMessage(iGREENstring);
              } 



Re: Taxes - IstuntmanI - 28.07.2015

Use a timer set to repeated at an interval of 20 minutes, when the player connects:
pawn Код:
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;
}



Re: Taxes - sscarface - 28.07.2015

Didn't work dude.