SA-MP Forums Archive
Saving timers on players - 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: Saving timers on players (/showthread.php?tid=312628)



Saving timers on players - Abreezy - 22.01.2012

How can you save timer on a specific player? Such as for payday something like:

Код:
pPayTime = 60000
Meaning, the player has 6 minutes left till payday. So let's say you have 6 minutes, then I decide to /q. When I come back, i want timer to continue from how much time was left. How would you do something like this? Thanks in advance.


Re: Saving timers on players - T0pAz - 22.01.2012

use SetTimerEx and pass playerid as a parameter.


Re: Saving timers on players - Abreezy - 22.01.2012

I know how to create timers..I meant as in how do I detect how much time is like and how do I re-activate the timer to that specific number.


Re: Saving timers on players - =WoR=Varth - 22.01.2012

Create a 1 minute timer. Each player have 60 minute to get the payday. If the player /q, save the remaining minute. Start the timer again if the player logged in.

Make a sense?


Re: Saving timers on players - T0pAz - 22.01.2012

use a global placeholder(variable) to hold the place of the creation timer and call it when you want to kill it.


Re: Saving timers on players - Buzzbomb - 22.01.2012

Add Another PlayerInfo File.. If im getting what ur saying ... Create a New file to users Account Like pPayday, and pHadPday,

And When the player returns Check OnPlayerLogged or What ever u have For showing the player Online and Logged it Have it check to see if the Player Had a payday If its 0 Have it Give them Last Payday...
After it gives them a Payday Make another User define name pHadPday, have it set it to 1 So if the player relogs he comes back it checks both files if pHadPday It wont give them another

For Example

pawn Код:
have a timer or ur login command call on PlayerLoggedOn(playerid);
public PlayerLoggedOn(playerid)
{

       if(PlayerInfo[playerid][pHadPday] == 1)
       {
           // Do Nothing
       }
       else if(PlayerInfo[playerid][pHadPday] == 0)
       {
             if(PlayerInfo[playerid][pPayday] == 1)
             {
                  //Do Nothing aswell
             }
             else if(PlayerInfo[playerid][pPayday] == 0)
             {
                 // Command to give them last payday
             }
      }
      return 1;
}

Yeah or Like =WoR=Varth Said..