Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds

Members Online

»
0 Active | 69 Guests
Online:

LATEST FORUM THREADS

»
CoD: Battle Royale
CoD+UO Map + Mod Releases
Damaged .pk3's
CoD Mapping
heli to attack ai
CoD4 SP Mapping

Forums

»

Welcome to the MODSonline.com forums. Looking for Frequently Asked Questions? Check out our FAQs section or search it out using the SEARCH link below. If you are new here, you may want to check out our rules and this great user's guide to the forums and the website.
For more mapping and modding information, see our Wiki: MODSonWiki.com

Jump To:
Forum: All Forums : Call of Duty 4
Category: CoD4 Scripting
Scripting and coding with Call of Duty 4.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername, novemberdobby
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Hud elm for only one team
Opel
General Member
Since: Dec 18, 2008
Posts: 21
Last: Sep 4, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Tuesday, Apr. 6, 2010 08:08 am
hey guys. Im trying to find out if you are able to show a hud elm just for one team. so it is like on allies team it will show my kills and deaths but the axis wont have that it. if im not clear about it tell me and i will try to explain again. thanks
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Apr. 6, 2010 08:37 am
Just check which team you're on and thread to your hud element:

Code:
	if( self.pers["team"] == "allies" )
		thread doStuff();


Obviously, that would need to go in a function like onPlayerSpawned(). And doStuff() is just an example of the name of a function which contains your hud element.
Share |
Opel
General Member
Since: Dec 18, 2008
Posts: 21
Last: Sep 4, 2011
[view latest posts]
Level 1
Category: CoD4 Scripting
Posted: Tuesday, Apr. 6, 2010 08:59 am
thanks it worked

edit: Uhm how would i fix it so when somebody switches teams they dont get the old teams hud ontop of the new teams hud i tried
Code:

if (isdefined(self.hud_kills)) self.hud_kills destroy(); 
if (isdefined(self.hud_deaths)) self.hud_deaths destroy();  

but it didnt work i did it for both huds
edited on Apr. 6, 2010 09:57 am by liamo7
Share |
.KiLL3R.
General Member
Since: Oct 26, 2006
Posts: 1437
Last: Jul 3, 2017
[view latest posts]
Level 8
Category: CoD4 Scripting
Posted: Tuesday, Apr. 6, 2010 02:17 pm
Code:
teamhud = newTeamHudElem("allies");
teamhud.hidewhendead = true;
.
.
other hud stuff like image, text
.


Everything is handled automatically with that, you don't have to worry about what happens if a player switches team ect.


eh >.< just realised liamo7 wants player specific HUD elements only when on a certain team, this code won't work for that, but I'll keep it here just for info though
edited on Apr. 6, 2010 10:19 am by .KiLL3R.
Share |
DemonSeed
General Member
Since: Apr 30, 2009
Posts: 1362
Last: Feb 19, 2018
[view latest posts]
Level 8
Im a fan of MODSonair
Category: CoD4 Scripting
Posted: Tuesday, Apr. 6, 2010 03:50 pm
liamo7 writes...
Quote:
thanks it worked

edit: Uhm how would i fix it so when somebody switches teams they dont get the old teams hud ontop of the new teams hud i tried
Code:

if (isdefined(self.hud_kills)) self.hud_kills destroy(); 
if (isdefined(self.hud_deaths)) self.hud_deaths destroy();  

but it didnt work i did it for both huds
edited on Apr. 6, 2010 09:57 am by liamo7


Its all a case of calling the destroy() function in the right callback. Because the player is suiciding when switching teams, if you destroy the element at the callback_playerkilled() method you shouldn't get the overlap.

I routinely have a function to clear all hud elements after a player dies, as do most big mods for COD4.
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 4 : CoD4 Scripting

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»