Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. Red Dead Redemption 2

      1. Gameplay
      2. Missions
      3. Help & Support
    2. Red Dead Online

      1. Gameplay
      2. Find Lobbies & Outlaws
      3. Help & Support
    1. Crews & Posses

      1. Recruitment
    2. Events

    1. GTA Online

      1. Arena War
      2. After Hours
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Grand Theft Auto Series

    3. GTA Next

    4. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    5. GTA IV

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    6. GTA Chinatown Wars

    7. GTA Vice City Stories

    8. GTA Liberty City Stories

    9. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    12. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    13. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption

    2. Rockstar Games

    1. Off-Topic

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

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

    2. Forum Support

    3. Site Suggestions

CrAzY_-7865

Notify timer

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

Share this post


Link to post
Share on other sites
Avi5006

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

Share this post


Link to post
Share on other sites
StAfFMaN

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

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
StAfFMaN

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
StAfFMaN

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,

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites
CrAzY_-7865
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

Share this post


Link to post
Share on other sites
StAfFMaN
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 !!

Share this post


Link to post
Share on other sites
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;
}

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 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.