How to code a payday?
#2

pawn Код:
new payDAY[ MAX_PLAYERS ] = {-1, ...};

forward public Pay_Player( playerid );

#define PAY_EVERY_MINS 5 // pay every 5 minutes

public OnPlayerConnect( playerid )
{
      payDAY[ playerid ] = SetTimerEx( "Pay_Player", PAY_EVERY_MINS * 60, 1, "d", playerid );
      return 1;
}

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


public Pay_Player( playerid )
{
      switch( GetPlayerLevel( playerid ) )
      {
             case 1: GivePlayerMoney( playerid, 500 ), SendClientMessage( playerid, -1, "Received paycheck." );
             case 2: ... ;
      }
      return 1;
}
Or just set a global timer and check if the player's connected, but this is better. This is a rather easy technique, there's a better get_time() technique, but this should work too!
Reply


Messages In This Thread
How to code a payday? - by Unri - 26.10.2013, 05:38
Re: How to code a payday? - by RajatPawar - 26.10.2013, 05:45
Re: How to code a payday? - by rickisme - 26.10.2013, 05:53
Re: How to code a payday? - by Pottus - 26.10.2013, 06:15
Re: How to code a payday? - by RajatPawar - 26.10.2013, 06:31
Re: How to code a payday? - by rickisme - 26.10.2013, 13:35
Re: How to code a payday? - by BigGroter - 26.10.2013, 13:43
Re: How to code a payday? - by Memoryz - 26.10.2013, 14:02
Re: How to code a payday? - by rickisme - 26.10.2013, 14:03

Forum Jump:


Users browsing this thread: 1 Guest(s)