Results 1 to 3 of 3

Thread: Script Error

  1. #1
    ... connecting
    Join Date
    Feb 2013
    Posts
    7
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Script Error

    Hey,

    I have a problem with my Hide & Seek mod on 1.2 & 1.3 everything works perfect but on 1.0 I get this error :

    PHP Code:
    ******* script runtime error *******
    cannot cast undefined to bool: (file 'maps/mp/gametypes/hns2.gsc'line 1620)
     if(!
    level.newround)
        *
    called from:
    (
    file 'maps/mp/gametypes/hns2.gsc'line 705)
     
    count(); 
    This is the Part of the script :

    PHP Code:
    if(!level.newround)
        {
            if (
    self.pers["team"]=="allies"
            {
                
    self.pers["team"]="axis";
                
    self.sessionteam="axis";
                
    self.hud_skills destroy();
                
    self.hud_skill1 destroy();
                
    self.hud_skill2 destroy();
                
    self.hud_skill3 destroy();
                
    self.hud_skillt destroy();
                
    count();

                
    wait 2;
                if(
    doKillcam && level.killcamself maps\mp\gametypes\_killcam::killcam(attackerNum2psOffsetTimetrue);
                if (
    isDefined(self.blackscreen)) self.blackscreen destroy();
                if (
    isDefined(self.hud_kiir)) self.hud_kiir destroy();
                
    self thread moveplayer("axis");
            }
            else 
            {
                
    self.hud_skills destroy();
                
    self.hud_skill1 destroy();
                
    self.hud_skill2 destroy();
                
    self.hud_skill3 destroy();
                
    self.hud_skillt destroy();

                
    wait 1.5;
                if(
    doKillcam && level.killcamself maps\mp\gametypes\_killcam::killcam(attackerNum2psOffsetTimetrue);
                
    self thread respawn();
            }
        } 
    Last edited by AnGeR; 14th December 2013 at 16:56.

  2. #2
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    define the 'level.newround'
    "Don't worry if your code doesn't work correctly - if everything worked, you would not work" ~Mosher's right

  3. #3
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Im kinda tired of these kind of posts.
    Lets analyze your error shall we?

    Code:
    cannot cast undefined to bool: (file 'maps/mp/gametypes/hns2.gsc', line 1620)
     if(!level.newround)
        *
    Now, what the error is saying:
    cannot cast undefined to bool

    The star indicates what variable cannot be cast to a bool because it's undefined.

    the star is under level.newround.

    So this tells us

    the script throws an error
    because
    level.newround is undefined
    and
    it is used as a bool(ean).

    You get the picture?

    The variable is undefined
    and you are trying to use it as a bool

    to fix this
    define it!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •