View Full Version : [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
IzNoGoD
21st May 2016, 14:20
just .archived=false the hud elem and create it for both spectator and player
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
serthy
22nd May 2016, 08:50
You have to change some Hud properties.
hud.x = 0;
hud.y = 0;
hud.xAlign = "center";
hud.yAlign = "middle";
hud MoveOverTime( 2.0 );
hud.x = 100;
hud.y = 100;
I dont know the exact names of the properties nor the exact order, but it should give you another start.
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 ?
IzNoGoD
22nd May 2016, 09:53
dude what the hell.
Just do stuff onspawn() and onjoinspectator().
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
Ni3ls
22nd May 2016, 13:03
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
serthy
22nd May 2016, 15:24
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.
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.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.