SA-MP Forums Archive
continuing a timer? - 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: continuing a timer? (/showthread.php?tid=396943)



continuing a timer? - Elysian` - 02.12.2012

I want to know how to continue a timer, such as when you /jail or for a paycheck?

And I don't want to use the gettime function.


Re: continuing a timer? - Ballu Miaa - 02.12.2012

Either you can set a repeated timer or you can call the function every second and make it limited but yet repeated.

1. Setting a Repeated Timer without limits.
pawn Код:
forward function();

SetTimer("function", 1000, true); // Set a repeated timer of 1000 miliseconds (1 second)

public function()
{
    print("Function has been called.");
}

2. Setting a repeated timer with limits.


pawn Код:
forward function(numb);

new no =  20;
new Timer = SetTimerEx("function", 1000, true,"d",no); // Set a repeated timer of 1000 miliseconds (1 second)

public function(numb)
{
    if(numb == 0)
    {
        KillTimer(Timer);
    }
    print("Value:%d");
    numb--;
}



Re: continuing a timer? - Elysian` - 02.12.2012

LolWut?

Can you tell me how I'd make a payday system and the timer would continue when the player logs in?


Re: continuing a timer? - Elysian` - 02.12.2012

Please?


Re: continuing a timer? - Ballu Miaa - 02.12.2012

Quote:
Originally Posted by Windows32
Посмотреть сообщение
LolWut?

Can you tell me how I'd make a payday system and the timer would continue when the player logs in?
You know what , half of the new people on the forum never really wanted to learn Scripting. All they want to do is Code a goddamn a server in which 5-10 players will be playing and make the same type of game mode all over again using old generation techniques callback names and everything.

@Every New Scripter - If you dont want to learn PAWN Scripting and your here to fix your Edited Game Mode of your Server Bugs and issues so that will not help you at all. Stop wasting money , time , energy etc in ever trying so.


Re: continuing a timer? - Elysian` - 02.12.2012

I only want the basic of it, calm down.


Re: continuing a timer? - Calgon - 02.12.2012

Create a function that is called every 1 second (so a timer), save a variable to the player's file, add it up in seconds and when the amount of seconds is equal to 3600 (or higher), you can issue the money to the player.


Re: continuing a timer? - Ballu Miaa - 02.12.2012

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Create a function that is called every 1 second (so a timer), save a variable to the player's file, add it up in seconds and when the amount of seconds is equal to 3600 (or higher), you can issue the money to the player.
Thats the Logic behind your so called Payday system.


Re: continuing a timer? - Calgon - 02.12.2012

Quote:
Originally Posted by Ballu Miaa
Посмотреть сообщение
Thats the Logic behind your so called Payday system.
Thank you captain obvious. Could your post be any more useless?


Re: continuing a timer? - Ballu Miaa - 03.12.2012

Quote:
Originally Posted by Calgon
Посмотреть сообщение
Thank you captain obvious. Could your post be any more useless?
Just became more useless bro! xD. Much Love! @Moderators - Forgive me for posting uselessly.