Code: Select all
stevo_score_set()
{
for(;;)
{
if (getcvar("stevo_score_set")!="")
{
self.stevo_new_score = getcvar("stevo_score_set"); // This will be newscore
setcvar("stevo_score_set","");
}
wait 0.5;
}
}
stevo_score()
{
level endon("boot");
level endon("round_ended");
setcvar("stevo_score", "");
if(!isDefined(self.stevo_new_score))
self.stevo_new_score = 0;
while(1)
{
if(getcvar("stevo_score") != "")
{
if (getcvar("stevo_score") == "all")
setcvar("stevo_score", "-1");
movePlayerNum = getcvarint("stevo_score");
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
player = players;
thisPlayerNum = player getEntityNumber();
if(thisPlayerNum == movePlayerNum || movePlayerNum == -1)
{
// DEBUG //
iprintlnbold("PLAYERS SCORE: " + players.score); // ok, ( ingame)
iprintlnbold("NEW SCORE: " + self.stevo_new_score); // ok, ( ingame)
players.score = self.stevo_new_score; // this is the problem ..
// it doesn't add the value
//of self.stevo_new_score
// I think cuz its a string and
// not a number.. can i convert
// it or something ?
Iprintlnbold("FINAL SCORE: " + players.score); // final score is
// same as old one.. ( didn't do nothing )
}
}
setcvar("stevo_score", "");
}
wait 0.05;
}
}
The code was meant to give a custom score to custom player... but ... i don't know the problem here..