Results 1 to 10 of 20

Thread: [Tutorial][Work in progress] Hud elements

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by pollo View Post
    Hey

    I had some trouble while setting the alpha value of some huds by using the "fadeovertime()" function (sometimes when 2 funcs change the alpha value of a same hud, it kinda "flashes", or become transparent/opaque in a short time), so I made this little one which seems to work fine.

    PHP Code:
    //call the function like this:

    //thread _alphahud(level.hud,true);

    //hud = your hud
    //show = boolean (true, hud fades to opaque; false, it fades to transparent)
    //you can also add a time variable in the function to edit it at your own

    _alphahud(hud,show)
    {
    self endon("disconnect");
        for(
    i=0;i<20;i++)
        {
            if(
    show == true)
            {
            
    hud.alpha += 0.05;
                if(
    hud.alpha == 1)
                    break;
            }
            else
            {
            
    hud.alpha -= 0.05;
                if(
    hud.alpha == 0)
                    break;
            }
        
    wait .05;
        }
    return;

    As there is no loop function running continuously, do not use an endon(). This will add to the max number of script variables allowed, and is completely unnecessary unless you have a loop function which does more than count (as in the current method). Endon() is designed to kill continuous loops only. It will not end any other function such as a count.

    Max script variables will crash a server, and is reached when the game counts ever single instance of endon(), waittill(), or wait(). Conserve your script variables at all costs. It is very easy to reach the ceiling with them.

  2. The Following 2 Users Say Thank You to Tally For This Useful Post:

    guiismiti (23rd September 2014),pollo (23rd September 2014)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •