Results 1 to 9 of 9

Thread: Position display

  1. #1
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts

    Position display

    Hi,

    Just a simple idea I had to help people who need to know their position in maps in case they wanna spawn something with a mod.

    I used to use the print function to check my position every 0.1s and took screenshots of the values. I noticed some people here use the same method.

    I created these huds to show the position in a more "comfortable" way.



    1. Precache these strings
    PHP Code:
        game["labelx"] = &"^1X: ^7";
        
    precacheString(game["labelx"]);
        
    game["labely"] = &"^1Y: ^7";
        
    precacheString(game["labely"]);
        
    game["labelz"] = &"^1Z: ^7";
        
    precacheString(game["labelz"]); 
    2. Call this function when the player spawns
    PHP Code:
        if(isdefined(self.hud_positionx))
            
    self.hud_positionx destroy();

        
    self.hud_positionx newClientHudElem(self);
        
    self.hud_positionx.= -80;
        
    self.hud_positionx.= -15;
        
    self.hud_positionx.alignx "left";
        
    self.hud_positionx.horzAlign "right";
        
    self.hud_positionx.vertAlign "middle";
        
    self.hud_positionx.fontScale 1;
        
    self.hud_positionx setValue(0);
        
    self.hud_positionx.sort 9986;
        
    self.hud_positionx.label game["labelx"];

        if(
    isdefined(self.hud_positiony))
            
    self.hud_positiony destroy();

        
    self.hud_positiony newClientHudElem(self);
        
    self.hud_positiony.= -80;
        
    self.hud_positiony.0;
        
    self.hud_positiony.alignx "left";
        
    self.hud_positiony.horzAlign "right";
        
    self.hud_positiony.vertAlign "middle";
        
    self.hud_positiony.fontScale 1;
        
    self.hud_positiony setValue(0);
        
    self.hud_positiony.sort 9986;
        
    self.hud_positiony.label game["labely"];

        if(
    isdefined(self.hud_positionz))
            
    self.hud_positionz destroy();

        
    self.hud_positionz newClientHudElem(self);
        
    self.hud_positionz.= -80;
        
    self.hud_positionz.15;
        
    self.hud_positionz.alignx "left";
        
    self.hud_positionz.horzAlign "right";
        
    self.hud_positionz.vertAlign "middle";
        
    self.hud_positionz.fontScale 1;
        
    self.hud_positionz setValue(0);
        
    self.hud_positionz.sort 9986;
        
    self.hud_positionz.label game["labelz"];

        for(;;)
        {
            
    wait 0.1;
            
    origin self getOrigin();
            
    self.hud_positionx setValue(origin[0]);
            
    self.hud_positiony setValue(origin[1]);
            
    self.hud_positionz setValue(origin[2]);
        } 

    Click image for larger version. 

Name:	shot0008.jpg 
Views:	154 
Size:	170.5 KB 
ID:	802
    Last edited by guiismiti; 29th November 2014 at 06:39.
    set logfile 2

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

    kung foo man (29th November 2014),Mitch (29th November 2014),pollo (29th November 2014)

  3. #2
    Global Mossaderator Mitch's Avatar
    Join Date
    Nov 2012
    Posts
    654
    Thanks
    204
    Thanked 450 Times in 305 Posts
    I mostly use a cvar function to print my position and then i type 'condump log.txt' to dump my console log to a file.

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

    guiismiti (29th November 2014),pollo (29th November 2014)

  5. #3
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Manual client command: /viewpos shows the position and angle, too
    timescale 0.01

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

    guiismiti (29th November 2014)

  7. #4
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    interesting, will do something about that.


    editted: forgot to mention the obvious - use thread for the function, since there's an infinite loop inside.
    set logfile 2

  8. #5
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    viewpos shows the position from which the player is viewing, not his origin
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  9. #6
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by IzNoGoD View Post
    viewpos shows the position from which the player is viewing, not his origin
    well, viewpos returns the player's origin + 60 added to Z coordinate. So, they are basically the same thing. You simply have to take 60 units off the Z coordinate.

  10. #7
    Corporal guiismiti's Avatar
    Join Date
    Dec 2013
    Location
    Brazil
    Posts
    244
    Thanks
    121
    Thanked 42 Times in 31 Posts
    Quote Originally Posted by Tally View Post
    well, viewpos returns the player's origin + 60 added to Z coordinate. So, they are basically the same thing. You simply have to take 60 units off the Z coordinate.
    so, is origin the feet and viewpos the eyes?
    set logfile 2

  11. #8
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by guiismiti View Post
    so, is origin the feet and viewpos the eyes?
    Yes, that is correct.

  12. #9
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Quote Originally Posted by Tally View Post
    well, viewpos returns the player's origin + 60 added to Z coordinate. So, they are basically the same thing. You simply have to take 60 units off the Z coordinate.
    Confirmed, although viewpos uses integers.

    Also, +11 for prone and +40 for crouch
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

Tags for this Thread

Posting Permissions

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