Error for what seems like no reason

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

Post Reply
F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Error for what seems like no reason

Post by F |Madness| U » June 15th, 2011, 10:59 pm

Okay so I have been using code (such as below) to show messages in my mod for a while, and now for some reason I am getting errors with it. The error is: pair `undefined` and `2` has unmatching types `undefined` and `int` maps\mp\gametypes\_hud_util line 266.

The code I am using is below, and the code in _hud_util is below that.

But I just don't understand, I am using the exact same code but it is now giving these errors and I don't know why.

Code: Select all

AuthorText = createServerFontString( "Objective", 2 );
        AuthorText setPoint( "CENTER", "TOP", 0, 0 );
        AuthorText setText("^1My Mod ^31.00 by ^5Madness");

Code: Select all

createServerFontString( font, fontScale, team )
{
        if ( isDefined( team ) )
                fontElem = newTeamHudElem( team );
        else
                fontElem = newHudElem( self );
        
        fontElem.elemType = "font";
        fontElem.font = font;
        fontElem.fontscale = fontScale;
        fontElem.x = 0;
        fontElem.y = 0;
        fontElem.width = 0;
        fontElem.height = int(level.fontHeight * fontScale);  ---- line 266
        fontElem.xOffset = 0;
        fontElem.yOffset = 0;
        fontElem.children = [];
        fontElem setParent( level.uiParent );
        fontElem.hidden = false;
        
        return fontElem;
}
I would love anyhelp with this.. it is really annoying me I just don't understand why I am suddenly getting this error.
-

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Error for what seems like no reason

Post by F |Madness| U » June 15th, 2011, 11:20 pm

Okay this is what I really don't understand. I have 2 pieces of code :

Code: Select all

AuthorText = createServerFontString( "extrabig", 2 );
        AuthorText setPoint( "CENTER", "CENTER", 0, -180 );
        AuthorText.sort = 1001;
        AuthorText setText("^1Mymod ^31.00 by ^5Madness");
and

Code: Select all

        gametypeswitchText = createServerFontString( "extrabig", 2 );
        gametypeswitchText setPoint( "CENTER", "CENTER", 0, -80 );
        gametypeswitchText.sort = 1001;
        gametypeswitchText setText("^2Incorrect Gametype Loaded. ^5Switching Gametype In 5");
The first piece of code gives the error mentioned above, the second code works fine, yet I'm sure there is no difference between them. Help please.
Last edited by F |Madness| U on June 15th, 2011, 11:57 pm, edited 1 time in total.
-

User avatar
Rezil
Core Staff
Core Staff
Posts: 2030
Joined: July 24th, 2006, 11:21 am
Location: Cramped in a small cubicle/making another jump map

Re: Error for what seems like no reason

Post by Rezil » June 15th, 2011, 11:42 pm

Last line in code 1: you have an extra ].
Drofder2004: Drofder's rules for reviewing a map
[...]
#5 If your name is Rezil, minimum 5/5.
---
<LT>YosemiteSam[NL]:
I heard somewhere that the best way to start is juggling 2 balls with one hand, so you will get a feel for it.

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Error for what seems like no reason

Post by F |Madness| U » June 15th, 2011, 11:57 pm

Thats not in my code, that was just an error when inputting the code into these forums :P So yeah still got this problem.. I really don't understand it.
-

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Error for what seems like no reason

Post by IzNoGoD » June 16th, 2011, 1:01 am

Lemme guess where the star under the error is in this line:
fontElem.height = int(level.fontHeight * fontScale);
Its under the level.fontheight right? (or the L of level.fontheight for that matter)

This means your level.fontheight is undefined. Define it somewhere.

Edit: some more stuff that should be different if this were cod2:

fontElem = newHudElem( self );
should be
fontElem = newClientHudElem( self );

and the text should be a (semi) localized string that needs precaching.

I dont know about these issues in cod4, but i would look into it nonetheless
LMGTFY!

Its not a glitch... Its the future!

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Error for what seems like no reason

Post by F |Madness| U » June 16th, 2011, 7:39 pm

Seems to be because I was calling the thread on init(), rather than onPlayerConnect() or something else.
-

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests