Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Player HUD On Crosshair

  1. #1
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts

    Player HUD On Crosshair

    ENG ;
    Hi
    where can I find a script:
    when tracking the player is showing up his nickname because he wanted me to add to this rank money etc

    If the council can not Find an access this script if anyone can share it?

    sryy for bad english

    PL :
    Czesc
    gdzie moge znaleźć skrypt :
    gdy namierze na gracza to pokazuje sie jego nick bo chcial bym dodac do tego rank money itp

    Jezeli nie da rady znalesc tego skryptu czy moze ktos go udostepnic ?

  2. #2
    Private
    Join Date
    Aug 2012
    Posts
    78
    Thanks
    20
    Thanked 10 Times in 5 Posts
    [PL] -> Spróbuj tego ,jeżeli coś nie będzie działać to wróc tutaj.
    [ENG] -> Try this, if something does not work to go back here.

    Ps. If anyone from staying here sees errors, please improvement script..

    PHP Code:
    init()
    {
        
    thread waitforconnected();
    }

    waitforconnected()
    {
        while (
    true)
        {
            
    level waittill("connected"player);    
            
    player thread waitforspawn();
        }
    }

    waitforspawn()
    {
        
    self endon("disconnect");
        
        while (
    true)
        {
            
    self waittill("spawned_player");
            
    self thread isLookingAtPlayer();
        }
    }

    isLookingAtPlayer()
    {
        
    self endon("disconnect");
        
        
    players getentarray("player""classname");
        
    player undefined;    
        for(
    i=0;players.size;i++)
        {
            if(
    self islookingat(players[i]))
            {
                
    player players[i];
                
                
    self.hud_looking newClientHudElem(self);
                
    self.hud_looking.320;
                
    self.hud_looking.240;
                
    self.hud_looking.alignX "center"
                
    self.hud_looking.alignY "middle";
                
    self.hud_looking.sort 1;
                
    self.hud_looking.alpha 0;
                
    self.hud_looking.fontScale 1.2;
                
    self.hud_looking setText(&"Rank: "+player.rank);
                
                
    self.hud_looking fadeOverTime(0.2);
                
    self.hud_looking.alpha 1;
            }
            else
            {
                
    self.hud_looking.alpha 0;
                
    self.hud_looking undefined;
            }
        }

    Script show only rank

  3. The Following User Says Thank You to Moczulak For This Useful Post:

    kung foo man (13th February 2013)

  4. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,725
    Thanks
    17
    Thanked 1,080 Times in 682 Posts
    settext with a non precached string... way to go...


    .label and setvalue

  5. #4
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,014
    Thanks
    2,110
    Thanked 1,086 Times in 753 Posts
    Hope that would work:

    PHP Code:
    init()
    {
        
    precacheString(&"Rank: ");
        
    thread waitforconnected();
    }

    self.hud_looking setText(&"Rank: ");
    self.hud_looking setValue(player.rank); 
    The performance would be better with a bullettrace(..........to forward.........)["entity"]
    timescale 0.01

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

    Killer.Pro (14th February 2013)

  7. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,725
    Thanks
    17
    Thanked 1,080 Times in 682 Posts
    .label, not settext ffs.

  8. The Following User Says Thank You to IzNoGoD For This Useful Post:

    Earliboy (14th February 2013)

  9. #6
    Private First Class Earliboy's Avatar
    Join Date
    Nov 2012
    Location
    Germany
    Posts
    130
    Thanks
    5
    Thanked 88 Times in 61 Posts
    You want when someone is spectating? Or if youre playing and look at the player?
    Cause that script wouldnt work (in my opinion) cause it would check after respawn 1 time if u look at a player, if not it will wait for next respawn.
    So you would need an while(self isLookingAt(players[i])).

    I made this simple script (i know its not perfect but should work) but i dind't tested it yet.
    I think it should work, it should show the player.rank in the middle of the screen if you look at a player.

    Code:
    init()
    {
    	precacheString(&"^3Rank: ");
        thread waitforconnected();
    }
    
    waitforconnected()
    {
        while (true)
        {
            level waittill("connected", player);    
            player thread waitforspawn();
        }
    }
    
    waitforspawn()
    {
        self endon("disconnect");
    	
    	self.hud_looking = newClientHudElem(self);
    	self.hud_looking.x = 320;
    	self.hud_looking.y = 240;
    	self.hud_looking.alignX = "center"; 
    	self.hud_looking.alignY = "middle";
    	self.hud_looking.sort = 1;
    	self.hud_looking.alpha = 0;
    	self.hud_looking.fontScale = 1.2;
    	self.hud_looking.label = &"^3Rank: ";
    	
        while (true)
        {
            self waittill("spawned_player");
            self thread spawned();
        }
    }
    
    //The following part is made by Earliboy
    spawned()
    {
    	self notify("show_rank_restart");
    	self endon("disconnect");
    	self endon("show_rank_restart");
    	
    	if(!isAlive(self))
    		return;
    			
    	while(isAlive(self))
    	{
    		//Wait 2, otherwise it may lagg the server with to much players
    		wait 2;
    		
    		//Redefine the players (if someone new joined)
    		players = getEntArray("player","classname");
    		
    		for(i = 0; i < players.size; i++)
    		{
    			if(!isDefined(players[i]))
    				continue;
    				
    			if(!isAlive(players[i]))
    				continue;
    				
    			player = players[i];
    			
    			if(!self isLookingAt(player))
    				continue;
    			
    			self.hud_looking setValue(player.rank);
    			self.hud_looking fadeOverTime(0.2);
    			self.hud_looking.alpha = .7;
    			
    			while(self isLookingAt(player) && isAlive(self))
    				wait 2;
    		}
    	}
    	
    	self.hud_looking.alpha = 0;
    }
    No ... No ... this is not possible .......

  10. The Following User Says Thank You to Earliboy For This Useful Post:

    kung foo man (14th February 2013)

  11. #7
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    Earliboy
    You script work but if you stop to aim the person still shows hud

    pl :
    Twoj skrypt dziala lecz jesli przestane celowac w osobe to nadal pokazuje hud

  12. #8
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts
    I can't find what's wrong but try this, I wrote it a long time ago anyway should work... (it's just part of code... make it useful)

    Code:
    PlayersStats()
    {
    	while(isdefined(self))
    	{
    		trace = bullettrace(self geteye()+(0,0,20),self geteye()+(0,0,20)+maps\mp\_utility::vectorscale(anglestoforward(self getplayerangles()),99999),true,self);
    		if(isplayer(trace["entity"]))
    		{
    			if(!isdefined(self.info))
    			{
    				self.info = newClientHudElem(self);
    				self.info.alignx = "center";
    				self.info.aligny = "center";
    				self.info.x = 250;
    				self.info.y = 250;
    				self.info.fontscale = 0.8;
    				self.info.label = &"Name: ";
    				self.info setplayernamestring(trace["entity"]);
    				self.info.alpha = 0;
    				self.info fadeOverTime(0.4);
    				self.info.alpha = 1;
    			}
    			else
    			self.info setplayernamestring(trace["entity"]);
    		}
    		else if(!isplayer(trace["entity"]) && isdefined(self.info))
    		self.info destroy();
    		wait 0.05;
    	}
    }
    Precache:
    Code:
    precacheString(&"Name: ");

  13. The Following User Says Thank You to Jeplaa For This Useful Post:

    kung foo man (14th February 2013)

  14. #9
    Private First Class
    Join Date
    Feb 2013
    Posts
    201
    Thanks
    4
    Thanked 10 Times in 7 Posts
    Jeplaa
    You Srcipt dont work , who can repair Earliboy SCRIPT ?

  15. #10
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,725
    Thanks
    17
    Thanked 1,080 Times in 682 Posts
    PHP Code:
    main()
    {
        
    level.rankstring = &"Rank: ";
        
    precacheString(level.rankstring);
        
        
    thread waitforconnect();
    }

    waitforconnect()
    {
        while(
    true)
        {
            
    level waittill("connecting"player);
            
    player thread onconnect();
        }
    }

    onconnect()
    {
        
    self.playerrankhud newClientHudElem(self);
        
    self.playerrankhud.label level.rankstring;
        
    self.playerrankhud.alpha 0;
        
    self.playerrankhud.horzAlign "center_safearea";
        
    self.playerrankhud.vertAlign "center_safearea";
        
    self.playerrankhud.alignx "center";
        
    self.playerrankhud.aligny "middle";
        
    self.playerrankhud.0;
        
    self.playerrankhud.0;
        
    self.playerrankhud.archived false;
        
    self.playerrankhud.foreground false;

        while(
    isdefined(self))
        {
            
    self waittill("spawned_player");
            
    lookat undefined;
            while(
    isdefined(self) && isdefined(self.sessionstate) && self.sessionstate == "playing")
            {
                
    start self geteye() + (0020);
                
    forward anglestoforward(self getplayerangles());
                
    end start maps\mp\_util::vectorScale(forward1000); 
                
    trace bullettrace(startendtrueself);
                if(
    isdefined(trace["entity"]) && isplayer(trace["entity"]))
                {
                    
    self.playerrankhud.alpha 1;
                    
    self.playerrankhud setvalue(trace["entity"].rank);
                }
                else if(
    self.playerrankhud.alpha != 0)
                {
                    
    self.playerrankhud fadeovertime(0.5);
                    
    self.playerrankhud.alpha 0;
                }
                
    wait 0.05;
            }
            
    self.playerrankhud.alpha 0;
        }

    I will explain this script some time..

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

    Jeplaa (14th February 2013),kung foo man (14th February 2013)

Posting Permissions

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