ItsMods

Full Version: Functions iPrintLnBold()
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Help please with the function.

Example:
iPrintLnBold(null, "^5iprintlnbold test!");

What can I do to show the text on the screen for 5 seconds?
You can't
Or you call it twice or something and wait a few seconds between the 2, but you can't change the time of the message
iPrintLnBold("^5iprintlnbold test!", null);
Thread.sleep(1000);
iPrintLnBold("^5iprintlnbold test!", null);
Thread.sleep(1000);
iPrintLnBold("^5iprintlnbold test!", null);
Thread.sleep(1000);
iPrintLnBold("^5iprintlnbold test!", null);
Thread.sleep(1000);
iPrintLnBold("^5iprintlnbold test!", null);

but its best practice to only use sleeps in seperate threads!
Thank you for your answers
@pieter If you're gonna do it, at least do it right Troll

CSHARP Code
  1. void thread(object arg)
  2. {
  3. object[] args = (object[])arg;
  4. string msg = (string)args[0];
  5. ServerClient client = (ServerClient)args[1];
  6. int seconds = (int)args[2];
  7.  
  8. int currsec = 0;
  9. while (currsec != seconds)
  10. {
  11. currsec++;
  12. Owner.iPrintLnBold(msg, client);
  13. Thread.Sleep(1000);
  14. }
  15. }
  16.  
  17. void ShowMessage(string msg, ServerClient client, int seconds)
  18. {
  19. object[] args = { msg, client, seconds };
  20. ThreadPool.QueueUserWorkItem(new WaitCallback(thread), args);
  21. }
thank you JariZ!!!!
@litgar Remove the 'Owner.' part before iPrintLnBold (line 12), forgot that only RollTheDice uses Owner
(04-16-2012, 08:42)JariZ Wrote: [ -> ]@litgar Remove the 'Owner.' part before iPrintLnBold (line 12), forgot that only RollTheDice uses Owner

ok! Smile