Author Topic: How to make a gametext with changing colors  (Read 4504 times)

0 Members and 1 Guest are viewing this topic.

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
How to make a gametext with changing colors
« on: December 31, 2012, 12:44:10 pm »
Hi! Once I've found a topic of one guy(I don't remember his nick) where he asked us to make gamemode with changing colors.
I think that it must be posted somewhere, and i decided to post it in Tutorials group. Okay, now let's learn it!
[pawn]
forward gtchange01();// we are forwarding the 1st timer
forward gtchange02();// forwarding the 2nd timer
[/pawn]

now public OnGameModeInit
[pawn]
    SetTimer("gtchange01", 2000, 0);//we are starting 1st timer(2 secs), which will not be repeated
[/pawn]

[pawn]
public gtchange01()//We made a new public which is named as 1st timer (gtchange01)
{
    GameTextForAllBottom("~o~HELL~h~O");//we made a gametext for all in bottom which will be shown after 2 secs of GMInit
    SetTimer("gtchange02", 2000, 0);//we are starting the next timer(also 2 secs), and it also will not be repeated
    return 1;
}[/pawn]

[pawn]
public gtchange02()// we made a public of the 2nd timer(as 1st)
{
    GameTextForAllBottom("~h~HELL~o~O");//we made a gametext with another colours
    SetTimer("gtchange01", 2000, 0);//we are locking "the ring" by starting 1st timer
    return 1;
}[/pawn]

It works, I mean, it changes it's colours every 2 seconds


« Last Edit: December 31, 2012, 01:35:02 pm by NeskWriter »


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline NeskWriter

  • Crime Boss
  • ****
  • Posts: 355
    • View Profile
Re: How to make a gametext with changing colors
« Reply #1 on: December 31, 2012, 01:35:54 pm »
Ahah, sorry, forget to compare timers names. I fixed it now.


-Funniest quotes-

Quote from: asad3man
i cant able to understand

Offline heekz.shadow

  • LU testers
  • Made Man
  • *
  • Posts: 249
    • View Profile
Re: How to make a gametext with changing colors
« Reply #2 on: December 31, 2012, 08:54:53 pm »
Why 2 timers ?
Please don't follow the method described above, see this:

[pawn]
new tick = 0;

forward gtchange();

public OnGameModeInit()
{
         SetTimer("gtchange", 2000, 1);
}

public gtchange()
{
    switch(tick)
    {
         case 0:
                  GameTextForAllBottom("Your text with your colour No1 here");
                  tick = 1;
         case 1:
                  GameTextForAllBottom("Your text with your colour No1 here");
                  tick = 0;
    }
return 1;
}[/pawn]

Don't use too many timers, this version should be better..                 
Code: [Select]
[20:23] <habi> later only i heard that lu chatbox is customizable. On my first visit, it appeared ugly.
[20:23] <habi> May be that also be the reason why lu has no players