CrAzY_-7865 Posted June 16, 2018 Share Posted June 16, 2018 (edited) 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 June 16, 2018 by CrAzY_-7865 Link to comment Share on other sites More sharing options...
Avi5006 Posted June 20, 2018 Share Posted June 20, 2018 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 More sharing options...
StAfFMaN Posted June 21, 2018 Share Posted June 21, 2018 (edited) 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 June 21, 2018 by StAfFMaN Link to comment Share on other sites More sharing options...
CrAzY_-7865 Posted June 21, 2018 Author Share Posted June 21, 2018 (edited) 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 June 21, 2018 by CrAzY_-7865 Link to comment Share on other sites More sharing options...
CrAzY_-7865 Posted June 21, 2018 Author Share Posted June 21, 2018 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 More sharing options...
CrAzY_-7865 Posted June 21, 2018 Author Share Posted June 21, 2018 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 More sharing options...
StAfFMaN Posted June 21, 2018 Share Posted June 21, 2018 I think you aren't stupid and you can found without me ;) Link to comment Share on other sites More sharing options...
CrAzY_-7865 Posted June 21, 2018 Author Share Posted June 21, 2018 (edited) 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 June 21, 2018 by CrAzY_-7865 Link to comment Share on other sites More sharing options...
StAfFMaN Posted June 22, 2018 Share Posted June 22, 2018 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 More sharing options...
CrAzY_-7865 Posted June 22, 2018 Author Share Posted June 22, 2018 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 More sharing options...
CrAzY_-7865 Posted September 15, 2018 Author Share Posted September 15, 2018 (edited) 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 September 15, 2018 by CrAzY_-7865 Link to comment Share on other sites More sharing options...
StAfFMaN Posted September 24, 2018 Share Posted September 24, 2018 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 !! CrAzY_-7865 1 Link to comment Share on other sites More sharing options...
CrAzY_-7865 Posted May 12, 2019 Author Share Posted May 12, 2019 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now