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

Members Online

»
0 Active | 6 Guests
Online:

LATEST FORUM THREADS

»
water
CoD4 MP Mapping
Script errors
CoD4 MP 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, supersword, playername
Latest Posts
Subscribed Posts
Search
Restricted Access Restricted Access subscribe
Author Topic: Drawing a text with variable
przemekh10
General Member
Since: Aug 16, 2012
Posts: 17
Last: Jan 28, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Monday, Aug. 20, 2012 12: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 01: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: 480
Last: Apr 15, 2013
[view latest posts]
Level 5
Im a fan of MODSonair
Category: CoD2 Scripting
Posted: Monday, Aug. 20, 2012 01: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 01: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 |
przemekh10
General Member
Since: Aug 16, 2012
Posts: 17
Last: Jan 28, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Tuesday, Aug. 21, 2012 06:47 am
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 08:56 am
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 |
przemekh10
General Member
Since: Aug 16, 2012
Posts: 17
Last: Jan 28, 2013
[view latest posts]
Level 1
Category: CoD2 Scripting
Posted: Wednesday, Aug. 22, 2012 02: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 03: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 Restricted Access subscribe
MODSonline.com Forums : Call of Duty 2 : CoD2 Scripting

Latest Syndicated News

»
Why console gaming is dying
Quote:Consider this: Dedicated gaming sales — including living-room consoles...
Devs: Games are being dumb...
Click 'read more' to view the contents of this post.
Loadout
Gun Crafting to the Max. edited on Sep. 25, 2012 06:57 pm by Morp...
Introducing the Source Fil...
Surprised this wasn't made a long time ago. Sounds like a nice little feature.
Introducing the Source Fil...
The Source Filmmaker (SFM) is the movie-making tool built and used by us he...

Partners & Friends

»