Timer within command
#1

Hello community samp Today I have a question, Is not there an include or fragment of code that can make a timer within a command?


PHP код:
CMDexample (playeridparams [])
{
    
SendClientMessage (playerid, -1"Hello");
    
After (5// Five minutes
    
{
        
// Does the function
    
}
    return 
1;

After that it will be my stock.
Reply
#2

You can achive that with inline timers so you keep all that in the command
Reply
#3

Quote:
Originally Posted by Banditul18
Посмотреть сообщение
You can achive that with inline timers so you keep all that in the command
I just do not want to use a timer, since I'll use many timers 1 time only
Reply
#4

Use tickcount:
PHP код:

new 
tick,
commandtick;
// somewhere under gamemode/fs init
tick tickcount();
// Your command
CMDexample (playeridparams [])
{
    
SendClientMessage (playerid, -1"Hello");
    
commandtick tickcount(); // Get the milliseconds
    
return 1;
}
// somewhere in your code
if(tick commandtick) >= 300000 /* 300 seconds = 5 mins */ {
    
// Your things

Reply
#5

I just want everything in the command

EJ:

PHP код:
CMDengine (playeridparams [])
{
    
SendClientMessage (playerid, -1"Turning on engine ...");
    
After (1// When 1 minute passes
    
{
        
SendClientMessage (playerid, -1"Engine on");
    }

Reply
#6

Once the command is executed you need to execute it again to read the code inside it aka you need to postpone your actions in elsewhere using another function.
Reply
#7

Quote:
Originally Posted by v1k1nG
Посмотреть сообщение
Once the command is executed you need to execute it again to read the code inside it aka you need to postpone your actions in elsewhere using another function.
Thank You
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)