.:: [ PAYDAY HELP ]::.
#1

I have one qestion about payday system, i wanna to make when play connect to start timer what will count player online time and if he dissconnect and connect again to CONTINUE that timer and after 30min, he get 1000$ > can you help me.....
Reply
#2

I think this works (not tested)

It will create a file with the name of the player and saves the seconds he played, if seconds are 30 it will be set to 0 and the player gets $1000

pawn Код:
new SecondsPlayed[MAX_PLAYERS];

forward PayDay();

OnGameModeInit()
{
  SetTimer("PayDay", 1000, true);
  return 1;
}

public PayDay()
{
  for(new i=0; i<MAX_PLAYERS; i++)
  if(IsPlayerConnected(i))
  {
   new playername[24];
   GetPlayerName(i, playername, sizeof(playername));
   if(!dini_Exists(udb_encode(playername))) { dini_Create(udb_encode(playername)); }
   SecondsPlayed[playerid] = dini_Int(udb_encode(playername), "secondsplayed");
   SecondsPlayed[playerid]++;
   if(SecondsPlayed[playerid] == 30)
   {
     GivePlayerMoney(playerid, 1000);
     SecondsPlayed[playerid] = 0;
   }
   dini_IntSet(udb_encode(playername), "secondsplayed", SecondsPlayed[playerid]);
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)