Results 1 to 3 of 3

Thread: Progressbar on rank.

  1. #1
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts

    Progressbar on rank.

    Welcome.

    I would like to make progress bar for rank.
    Someone know how this could be done?

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,011
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    You can use some healthbar-script as rank-bar:

    Code:
    precache()
    {
    	precacheShader("gfx/hud/hud@health_cross.tga");
    	precacheShader("gfx/hud/hud@health_back.tga");
    	precacheShader("gfx/hud/hud@health_bar.tga");
    }
    
    run()
    {
    	deltaX = 7;
    	deltaY = 16;
    
    	self.healthcross = newClientHudElem(self);
    	self.healthcross.archived = true;
    	self.healthcross.horzAlign = "fullscreen";
    	self.healthcross.vertAlign = "fullscreen";
    	self.healthcross.alignX = "right";
    	self.healthcross.alignY = "top";
    	self.healthcross.x = 535 + deltaX; //543;
    	self.healthcross.y = 455 + deltaY;
    	self.healthcross setShader("gfx/hud/hud@health_cross.tga", 10-2, 10-2);
    
    	self.healthback = newClientHudElem(self);
    	self.healthback.archived = true;
    	self.healthback.horzAlign = "fullscreen";
    	self.healthback.vertAlign = "fullscreen";
    	self.healthback.alignX = "left";
    	self.healthback.alignY = "top";
    	self.healthback.x = 539 + deltaX; //547;
    	self.healthback.y = 455 + deltaY;
    	self.healthback setShader("gfx/hud/hud@health_back.tga", 90, 10-2);
    
    	self.healthbar = newClientHudElem(self);
    	self.healthbar.archived = true;
    	self.healthbar.horzAlign = "fullscreen";
    	self.healthbar.vertAlign = "fullscreen";
    	self.healthbar.alignX = "left";
    	self.healthbar.alignY = "top";
    	self.healthbar.x = 540 + deltaX; //548;
    	self.healthbar.y = 456 + deltaY;
    	self.healthbar.color = ( 0, 1, 0);
    	self.healthbar setShader("gfx/hud/hud@health_bar.tga", 88, 8-1);
    
    	self thread healthBarUpdate();
    }
    
    healthBarUpdate()
    {
    	player = self;
    
    	oldhealth = self.health;
    	width = undefined;
    
    	while (isDefined(player))
    	{
    		if (isDefined(self.health) && self.health != oldhealth)
    		{
    			health = self.health / self.maxhealth;
    
    			width = int(health * 88);
    
    			if (width < 1)
    				width = 1;
    
    			player.healthbar setShader("gfx/hud/hud@health_bar.tga", width, 8-1);
    			player.healthbar.color = ( 1.0 - health, health, 0);
    
    			oldhealth = player.health;
    		}
    		wait 0.10;
    	}
    }
    timescale 0.01

  3. The Following User Says Thank You to kung foo man For This Useful Post:

    Moczulak (6th November 2012)

  4. #3
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    Thanks man !

Posting Permissions

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