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

Members Online

»
0 Active | 113 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 2
Category: CoD2 Scripting
Scripting and coding with Call of Duty 2.
Moderators: foyleman, Foxhound, Mystic, StrYdeR, batistablr, Welshy, DrBiggzz, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Topic is Locked subscribe
Author Topic: Hud Element Question
church4593
General Member
Since: Sep 6, 2014
Posts: 12
Last: Sep 17, 2014
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 03:30 am
Code:
if(!isDefined(self.rankstatust))
	{
		self.rankstatust = newClientHudElem(self);
		self.rankstatust.horzAlign = "center_safearea";
		self.rankstatust.vertAlign = "center_safearea";
		self.rankstatust.alignX = "center";
		self.rankstatust.alignY = "middle";
		self.rankstatust.x = 300;
		self.rankstatust.y = 10;
		self.rankstatust.archived = true;
		self.rankstatust.alpha = 1;
		self.rankstatust.font = "default";
		self.rankstatust.fontscale = 1;
		self.rankstatust setText(rank2);
	}
	else
	{
		if(isDefined(self.rankstatust))
			self.rankstatust destroy();
	}


This is my code for my hud element. All it is supposed to do is put a word on the screen. Don't get me wrong it does. But heres my problem. When other people connect to the server. The word gets thicker and thicker and thicker. Which leads me to believe that the word is overlapping itself. I've tried every which way to figure out why this is happening and to stop it from happening but I just cant seem to figure out why. Please can someone help me with this situation.
Share |
ebusanta001
General Member
Since: Mar 3, 2013
Posts: 195
Last: Aug 25, 2020
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 02:11 pm
Hello, its me again.

Are you trying to put one "letter" or "word" (bunches of letters).
In case you use "word", each letter must seat in the right position.

Here are some suggestion for you:
- The conventional size of the screen is 640x480.

- You can calculate the position of the first letter of the word (which is the x here), based on "word size", "word scale" and "space between words".

- Once you get a init_x, you can get position of the rest easily

Good luck!

P.S: Dont make multiple posts. One is enough to catch people attention. You have 3 unnecessary posts here [eek]

edited on Sep. 9, 2014 07:12 am by ebusanta001
Share |
church4593
General Member
Since: Sep 6, 2014
Posts: 12
Last: Sep 17, 2014
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 03:57 pm
Thanks for the reply,
Sorry about the multiple posts, my pc was acting up and it made three separate posts. Ill be sure to watch over it next time. And ive checked those variables. It's not that the hud doesn't work though. Its the matter of facts that each time a person connects or someone enters the server that the word gets bolder and bolder. Again, me assuming that the hud is repeating itself and overlapping and overlapping instead of deleting itself before placing another hud.
Share |
ebusanta001
General Member
Since: Mar 3, 2013
Posts: 195
Last: Aug 25, 2020
[view latest posts]
Level 4
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Tuesday, Sep. 9, 2014 04:17 pm
church4593 writes...
Quote:
Thanks for the reply,
Sorry about the multiple posts, my pc was acting up and it made three separate posts. Ill be sure to watch over it next time. And ive checked those variables. It's not that the hud doesn't work though. Its the matter of facts that each time a person connects or someone enters the server that the word gets bolder and bolder. Again, me assuming that the hud is repeating itself and overlapping and overlapping instead of deleting itself before placing another hud.


Based on the clue you gave, I can only guess that the object "self" causes problem. Try to verify your script and correct the object. Also, a boolean can help you prevent repetition sometime.

Code:
players = getentarray("player", "classname")
for(i = 0; i < players.size; i++)
{
      if(!players[i].messageread)
             players[i] thread your_current_script();
}


Good luck
Share |
Restricted Access Topic is Locked subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 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

»