#1

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);
              } 
Reply
#2

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;
}
Reply
#3

Didn't work dude.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)