EvoloZz
2nd January 2013, 13:48
I was trying to make crappy rank system (just for test), but I already get errors. So I made huds and everything for it, but the error seems to occur in the hud, even tho i think it seems to be alright.
WARNING: The rank system is really crappy!!
So here's the error:
******* script runtime error *******
type string is not a float: (file 'maps/mp/gametypes/_rifles.gsc', line 750)
self.rankvalue setvalue(self.rank_name);
*
I dont even understand what it says, but ehh.
Here's the main script:
init()
{
self thread onPlayerConnect();
self thread ranks();
}
onPlayerConnect()
{
if(!isDefined(self.xp))
self.xp = 0;
}
ranks()
{
xp = self.xp;
switch(xp)
{
case 0:
self.rank = 1;
self.rank_name = "Private First Class";
break;
case 30:
self.rank = 2;
self.rank_name = "Private First Class I";
self rankup();
break;
case 120:
self.rank = 3;
self.rank_name = "Private First Class II";
self rankup();
break;
}
}
rankup()
{
self iprintlnbold("You have been promoted to ^3" + self.rank_name);
}
And if important, here's the hud:
Rank()
{
if(!isDefined(self.rank_name))
{
self thread maps\mp\gametypes\_ranks::init();
}
self endon("disconnect");
self endon("joined_spectators");
if(!isDefined(self.rankhud))
{
self.rankhud = newClientHudElem(self);
self.rankhud.horzAlign = "left";
self.rankhud.vertAlign = "top";
self.rankhud.x = 6;
self.rankhud.y = 70;
self.rankhud.sort = 1;
self.rankhud.alpha = 1;
self.rankhud.fontScale = 2;
self.rankhud.archived = true;
self.rankhud setText(game["hud_rank"]);
}
if(!isDefined(self.rankvalue))
{
self.rankvalue = newClientHudElem(self);
self.rankvalue.x = 6;
self.rankvalue.y = 90;
self.rankvalue.fontScale = 1.8;
}
while(1)
{
wait(0.3);
self.rankvalue setvalue(self.rank_name);
}
}
I have tried some ways to fix it, but no progress. I am sure there is an error in the scripts, but I am just blind -_-
WARNING: The rank system is really crappy!!
So here's the error:
******* script runtime error *******
type string is not a float: (file 'maps/mp/gametypes/_rifles.gsc', line 750)
self.rankvalue setvalue(self.rank_name);
*
I dont even understand what it says, but ehh.
Here's the main script:
init()
{
self thread onPlayerConnect();
self thread ranks();
}
onPlayerConnect()
{
if(!isDefined(self.xp))
self.xp = 0;
}
ranks()
{
xp = self.xp;
switch(xp)
{
case 0:
self.rank = 1;
self.rank_name = "Private First Class";
break;
case 30:
self.rank = 2;
self.rank_name = "Private First Class I";
self rankup();
break;
case 120:
self.rank = 3;
self.rank_name = "Private First Class II";
self rankup();
break;
}
}
rankup()
{
self iprintlnbold("You have been promoted to ^3" + self.rank_name);
}
And if important, here's the hud:
Rank()
{
if(!isDefined(self.rank_name))
{
self thread maps\mp\gametypes\_ranks::init();
}
self endon("disconnect");
self endon("joined_spectators");
if(!isDefined(self.rankhud))
{
self.rankhud = newClientHudElem(self);
self.rankhud.horzAlign = "left";
self.rankhud.vertAlign = "top";
self.rankhud.x = 6;
self.rankhud.y = 70;
self.rankhud.sort = 1;
self.rankhud.alpha = 1;
self.rankhud.fontScale = 2;
self.rankhud.archived = true;
self.rankhud setText(game["hud_rank"]);
}
if(!isDefined(self.rankvalue))
{
self.rankvalue = newClientHudElem(self);
self.rankvalue.x = 6;
self.rankvalue.y = 90;
self.rankvalue.fontScale = 1.8;
}
while(1)
{
wait(0.3);
self.rankvalue setvalue(self.rank_name);
}
}
I have tried some ways to fix it, but no progress. I am sure there is an error in the scripts, but I am just blind -_-