Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Support

    3. Suggestions

Notify timer


CrAzY_-7865
 Share

Recommended Posts

CrAzY_-7865

Hi guys!

 

I'm trying to put a notification repeating every few minutes. But I can not make it reappear, someone so kind as to give me a simple example?

eg:

Notify("Hello!");
//after 2 minutes
Notify("Hello!");

 

Edited by CrAzY_-7865
Link to comment
Share on other sites

is this for a menu and if so do you want it to notify after you open the menu 

Link to comment
Share on other sites

You need to create a timer :


 

Public class ... : ...
{
   bool timer = false;
   readonly int timerInterval = 3 000; //3 sec  if you need 2 minutes : 120 000
   int timerWait = 0;

   void OnTick(object sender, EventArgs e) // by default it's at the top of the script
   {
      NewTimerFunction(); // this function it's checked every ticks
      ...
   }

   Void NewTimerFunction()
   {
      if (timer == true && Game.GameTime > timerWait)
      {
         timer = !timer; // Timer is now off
         Notify("Hello!");
      }
      else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
      }
      return;
   }
}

 

Best regard ;)

Edited by StAfFMaN
Link to comment
Share on other sites

CrAzY_-7865
42 minutes ago, StAfFMaN said:

You need to create a timer :


 

Public class ... : ...
{
   bool timer = false;
   readonly int timerInterval = 3 000; //3 sec  if you need 2 minutes : 120 000
   int timerWait = 0;

   void OnTick(object sender, EventArgs e) // by default it's at the top of the script
   {
      NewTimerFunction(); // this function it's checked every ticks
      ...
   }

   Void NewTimerFunction()
   {
      if (timer == true && Game.GameTime > timerWait)
      {
         timer = !timer; // Timer is now off
         Notify("Hello!");
      }
      else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
      }
      return;
   }
}

 

Best regard ;)

Thanks, but I look for an example for the language c++

 

Edited by CrAzY_-7865
Link to comment
Share on other sites

CrAzY_-7865
2 hours ago, StAfFMaN said:

You need to create a timer :


 

Public class ... : ...
{
   bool timer = false;
   readonly int timerInterval = 3 000; //3 sec  if you need 2 minutes : 120 000
   int timerWait = 0;

   void OnTick(object sender, EventArgs e) // by default it's at the top of the script
   {
      NewTimerFunction(); // this function it's checked every ticks
      ...
   }

   Void NewTimerFunction()
   {
      if (timer == true && Game.GameTime > timerWait)
      {
         timer = !timer; // Timer is now off
         Notify("Hello!");
      }
      else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
      }
      return;
   }
}

 

Best regard ;)

But very thanks, i managed to get an idea!

Link to comment
Share on other sites

CrAzY_-7865
6 hours ago, StAfFMaN said:

You need to create a timer :


 

Public class ... : ...
{
   bool timer = false;
   readonly int timerInterval = 3 000; //3 sec  if you need 2 minutes : 120 000
   int timerWait = 0;

   void OnTick(object sender, EventArgs e) // by default it's at the top of the script
   {
      NewTimerFunction(); // this function it's checked every ticks
      ...
   }

   Void NewTimerFunction()
   {
      if (timer == true && Game.GameTime > timerWait)
      {
         timer = !timer; // Timer is now off
         Notify("Hello!");
      }
      else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
      }
      return;
   }
}

 

Best regard ;)

How could I put a second notification in the pause of the timer?

Link to comment
Share on other sites

CrAzY_-7865
38 minutes ago, StAfFMaN said:

I think you aren't stupid and you can found without me ;)

I do not know C ++ very well, so I ask for help. I'm studying C ++ www.sololearn.com

38 minutes ago, StAfFMaN said:

I think you aren't stupid and you can found without me ;)

 if (timer == true && Game.GameTime > timerWait)
      {
         timer = !timer; // Timer is now off
         Notify("Hello!");
      }
      else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
//possible here? because timer is excluded
      }

 

Edited by CrAzY_-7865
Link to comment
Share on other sites

You need to try some things

 

If you put the code here :

else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
		 Notify("Your second text"); // HERE
      }

I think it appear immediately when your run the script... So try to create a condition (another "else if" maybe ? ;) )

 

like that ? :

else if (timer == true && Game.GameTime > (timerWait /2))
{
   Notify("Your text");
}

Why (timerWait /2) ?Like this your text appear not immediately when the timer starting, but 1 minute after the timer started and 1 minute before the "hello!".

 

best regard,

Link to comment
Share on other sites

CrAzY_-7865
1 hour ago, StAfFMaN said:

You need to try some things

 

If you put the code here :

else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
		 Notify("Your second text"); // HERE
      }

I think it appear immediately when your run the script... So try to create a condition (another "else if" maybe ? ;) )

 

like that ? :

else if (timer == true && Game.GameTime > (timerWait /2))
{
   Notify("Your text");
}

Why (timerWait /2) ?Like this your text appear not immediately when the timer starting, but 1 minute after the timer started and 1 minute before the "hello!".

 

best regard,

All right, thank you, I'll give you an idea how to solve it based on your help. Thank you very much!

Link to comment
Share on other sites

  • 2 months later...
On 6/22/2018 at 2:03 PM, StAfFMaN said:

You need to try some things

 

If you put the code here :

else if (timer == false)
      {       
         timerWait = Game.GameTime + timerInterval; // Initialize the timer, take the present time and add the interval.
         timer = true; // The timer start : now
		 Notify("Your second text"); // HERE
      }

I think it appear immediately when your run the script... So try to create a condition (another "else if" maybe ? ;) )

 

like that ? :

else if (timer == true && Game.GameTime > (timerWait /2))
{
   Notify("Your text");
}

Why (timerWait /2) ?Like this your text appear not immediately when the timer starting, but 1 minute after the timer started and 1 minute before the "hello!".

 

best regard,

Hey what's up?

today I'm here again to ask you how could I not make her stay fixed and make sure that she gives me only when I'm looking for a specific ped? eg:
when the function finds a ped, the notification that warns me that the ped was found remains in loop. How could I make it disappear without using the natives of the game?

Edited by CrAzY_-7865
Link to comment
Share on other sites

  • 2 weeks later...
On 9/15/2018 at 10:11 PM, CrAzY_-7865 said:

Hey what's up?

today I'm here again to ask you how could I not make her stay fixed and make sure that she gives me only when I'm looking for a specific ped? eg:
when the function finds a ped, the notification that warns me that the ped was found remains in loop. How could I make it disappear without using the natives of the game?

Hi,

 

This isn't a timer, you need to use a simple " if " and "else if " condition.

 

Good luck !!

  • Like 1
Link to comment
Share on other sites

  • 7 months later...
CrAzY_-7865
On 9/24/2018 at 10:04 AM, StAfFMaN said:

Hi,

 

This isn't a timer, you need to use a simple " if " and "else if " condition.

 

Good luck !!

something like:
 

bool timer = false;
int timerWait = 0;
int timerInterval = 180000;
void TimerNotify(char* text) {
	if (timer == true && GAMEPLAY::GET_GAME_TIMER() > timerWait)
	{
		timer = !timer;
		Print(text);
	}
	else if (timer == false)
	{
		timerWait = GAMEPLAY::GET_GAME_TIMER() + timerInterval;
		timer = true; 
		Print(text); 
	}
	else if (timer == true && GAMEPLAY::GET_GAME_TIMER() > (timerWait / 2))
	{
		Print(text);
		return;//i added this because if i put in loop, he show always end timer remains fixed. I now testing for view if work.
	}
	return;
}

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.