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

Members Online

»
0 Active | 4 Guests
Online:

LATEST FORUM THREADS

»
warfare
CoD4 Map + Mod Releases
Voting menu on maps
CoD+UO General
Hauling 911
CoDBO3 General

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: Drawing a text with variable
cod2coder
General Member
Since: Aug 16, 2012
Posts: 20
Last: Jan 10, 2016
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Monday, Aug. 20, 2012 07:49 pm
I'm using this function:

Code:
showstats()
{

if(isdefined(level.rank))
{
	level.rank destroy();
}

level.rank = newHudElem();
level.rank.x = 325;
level.rank.y = 20;
level.rank.alignX = "right";
level.rank.alignY = "middle";
level.rank.sort = -3;
level.rank.alpha = 1;
level.rank.fontScale = 1.5;
level.rank.archived = true;
level.rank setText(&"Rank: ");
}


This work great with static text but I can't display variable.
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Aug. 20, 2012 08:26 pm
im guessing your trying to display Rank : 0 or w.e there rank is. for that you did the text part correct now make another hud but instead of setText use setValue and put your rank variable in there im guess self.rank? and then yeah it will display your rank. but remember to update the setValue hud when ever the person ranks up so it will show their new rank.
Share |
serthy
General Member
Since: Sep 8, 2010
Posts: 482
Last: Jun 28, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Aug. 20, 2012 08:45 pm
either lil liltc64 said it or:

hud.label = &"Rank: &&1"
hud setValue( player.rank );
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Aug. 20, 2012 08:53 pm
serthy writes...
Quote:
either lil liltc64 said it or:

hud.label = &"Rank: &&1"
hud setValue( player.rank );


yeah that is actually better forgot about label. just make sure to update it like i said.
Share |
cod2coder
General Member
Since: Aug 16, 2012
Posts: 20
Last: Jan 10, 2016
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Aug. 21, 2012 01:47 pm
Another problem :( When I write for example
"testvariable = 1" and then
"level.score setValue( testvariable );"
the script work fine. I see a text "Your Socre: 1". But when I try to display self.score there is a problem. I see only "Your Score: &&1".
Share |
IzNoGoD
General Member
Since: Nov 29, 2008
Posts: 694
Last: Nov 10, 2012
[view latest posts]
Level 6
Category: CoD2 Scripting
Posted: Tuesday, Aug. 21, 2012 03:56 pm
self/level/player/user are variables. Just as the testvariable = 1 you need to set them somehow (although not entirely true for self and level).

Using self at random is bad practice.

Another example of bad practice is using level hud elements to display player's info.
Share |
cod2coder
General Member
Since: Aug 16, 2012
Posts: 20
Last: Jan 10, 2016
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 09:48 am
So how to do this? (Rank + variable)

Screenshot
Share |
liltc64
General Member
Since: Feb 12, 2007
Posts: 906
Last: Oct 22, 2012
[view latest posts]
Level 7
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 10:00 am
if your still having problems just do what i said, very bold and simple as it gets and try finding a better way another time if you would like.
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

»