PayDay system
#1

I want to make payday system which saves the time.
like the player needs to play 60 minutes, when he connecting to the game the timer will start as a minutes.
when he disconnects the time left till 60 will be saved.

and in game when the time got to 60, he will get his paycheck.

i have a dini system inside my script.
i can do something like that?

PlayerInfo[playerid][pPayDayTime] = 0;
Reply
#2

You need a one second timer in which you'll do something like this:


pawn Код:
SetTimer("OneSecondTimer", 1000, 1);

public OneSecondTimer()
{
      for(new i = 0; i < MAX_PLAYERS; i++)
      {
            if(IsPlayerConnected(i))
            {  
                 PlayerInfo[i][pPayDayTime]++;
                 if(PlayerInfo[i][pPayDayTime] >= 60)
                 {
                     GivePlayerMoney(i, 200);
                     PlayerInfo[i][pPayDayTime] = 0;
                 }
            }
      }
}
And u will need to save the seconds inside players ini file.
Reply
#3

i did something like that:
every one minute it will add
checkpdtimer = SetTimer("CheckPayDay", 60000, 1);

Код:
forward CheckPayDay();

public CheckPayDay()
{
	for(new i=0;i<MAX_PLAYERS;i++)
	{
		if(IsPlayerConnected(i))
       	{
			PlayerInfo[i][pPayDayTime] += 1;
			if(PlayerInfo[i][pPayDayTime] == 60)
			{
				SendClientMessage(i, COLOR_WHITE, "Pay Check test!");
			}
		}
	}
return 1;
}
Reply
#4

Whats actually your problem? As I gave you the example above you need to reset the var after you give the payday so it will tick again to 60.

Do you know how to save the time with dini?
Reply
#5

i made it to work, you gave me timer every one second i need every 60 seconds which is one minute, thanks anyway
Reply
#6

Quote:
Originally Posted by PaulDinam
Посмотреть сообщение
i made it to work, you gave me timer every one second i need every 60 seconds which is one minute, thanks anyway
Timer ticks the 60 seconds which is 1 min, then resets to 0 and starts over.
Reply
#7

okay i made fully pay day system, which saves time when you logout , and when you login, the time starts to tick minute by minute
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)