Results 1 to 9 of 9

Thread: [COD4] moving the hud element based on which team the client joins ?

  1. #1
    ... connecting
    Join Date
    May 2016
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question [COD4] moving the hud element based on which team the client joins ?

    Hello

    i'm trying to create a hud element with a value that will be displayed on the top right if the player joins as a jumper
    and it moves and changes size and position to the middle of the screen if the player joins as spectator
    so spectators can see which fps the player they're spectating is using

    how do i do that ? can you give me an example please

    Thanks

  2. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    just .archived=false the hud elem and create it for both spectator and player
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

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

    kung foo man (21st May 2016)

  4. #3
    ... connecting
    Join Date
    May 2016
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have it .archived=false but still i can't make it change when you're a spectator and change back again to the original settings when you're a player

    basically i want it to do this


    while playing
    /////////////////////////////////
    /............................. hud1 /
    /....................................../
    /....................................../
    /....................................../
    /....................................../
    /////////////////////////////////


    while spectating
    /////////////////////////////////
    /....................................../
    /....................................../
    /.................hud1............../
    /....................................../
    /....................................../
    /////////////////////////////////

    can you give me an example please

    Thanks
    Last edited by Kaz; 22nd May 2016 at 08:44.

  5. #4
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    You have to change some Hud properties.

    PHP Code:
    hud.0;
    hud.0;
    hud.xAlign "center";
    hud.yAlign "middle";

    hud MoveOverTime2.0 );
    hud.100;
    hud.100
    I dont know the exact names of the properties nor the exact order, but it should give you another start.

  6. #5
    ... connecting
    Join Date
    May 2016
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks serthy,
    i know the basics of the hud and MoveOverTime won't help me with what i want for this case since the move have to be based on if the client joins as spectator or as a player not time based

    which leads me to my next question
    if what i want isn't possible with a hud element can it be done via a menu ?

  7. #6
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    dude what the hell.

    Just do stuff onspawn() and onjoinspectator().
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. #7
    ... connecting
    Join Date
    May 2016
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by IzNoGoD View Post
    dude what the hell.

    Just do stuff onspawn() and onjoinspectator().
    Of course i didn't try onspawn() and onjoinspectator() .. :facepalm: :smh:
    I'll figure it out

    Thanks anyway

  9. #8
    Brigadier General
    Join Date
    Dec 2012
    Posts
    1,012
    Thanks
    440
    Thanked 171 Times in 132 Posts
    Quote Originally Posted by Kaz View Post
    Of course i didn't try onspawn() and onjoinspectator() .. :facepalm: :smh:
    I'll figure it out

    Thanks anyway
    Sarcasm? What did you try already then? Show ur scripts

  10. #9
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Quote Originally Posted by Kaz View Post
    Thanks serthy,
    i know the basics of the hud and MoveOverTime won't help me with what i want for this case since the move have to be based on if the client joins as spectator or as a player not time based
    Afaik, in CoD4 you can hook the functions IzNoGoD mentioned. And then check the team player.pres["team"] == "spectator" // or "axies"/"allies" (if even neccesary) and change the HUD accordingly.

    PHP Code:
    FUNC onJoinedTeam()
        IF 
    player team is spectator
            move hud to mid
        
    ELSE
            
    move hud to corner
        
    ENDIF
    END 
    However all this stuff should already be (in parts) in the stock gamefiles, if you know the basics of a HUD, you should also be able to figure it out where and how to move them as you like, as this is one of the simpliest things you can do in scripting.
    Last edited by serthy; 22nd May 2016 at 15:27.

Posting Permissions

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