-
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.killcam) self maps\mp\gametypes\_killcam::killcam(attackerNum, 2, psOffsetTime, true);
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.killcam) self maps\mp\gametypes\_killcam::killcam(attackerNum, 2, psOffsetTime, true);
self thread respawn();
}
}
-
define the 'level.newround'
-
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!