Think of what you are typing..
Why would
level.score give you the PLAYER score.
Level is used for variables that can be accessed by the entire script, in any GSC. It is saved per level.
What you want is a PLAYER HUD along with player.score.
so, first off you need to get every player that connects to the server, and then you want to thread them to a new thread for when they spawn. This is the code to do so...
Code: Select all
onPlayerConnect()
{
level waittill("connected", player);
player thread onPlayerSpawn();
}
onPlayerSpawn()
{
for(;;)
{
self waittill("spawned_player");
self thread createHud();
}
}
Now you need to create the HUD, and also create a destroy hud thread, so you do not get an infinite loop of huds
Code: Select all
createHud()
{
self.killlabel = newClientHudElem(self);
self.killlabel.x = 15;
self.killlabel.y = 150;
self.killlabel.alignX = "center";
self.killlabel.alignY = "middle";
self.killlabel.sort = 1;
self.killlabel.fontScale = .8;
self.killlabel.alpha = 1;
self.killlabel.label = (&"^3Kills:^5");
self.killlabel setValue(self.kills);
self thread destroyHUD();
}
destroyHud()
{
while(self.pers["team"] != "spectator" || self.sessionstate != "playing")
wait 0.5;
self.killlabel destroy();
}
There is zero testing to this code, with snippets taken from CJ mod and the rest my own head. It is written with CoD4 in mind and may or may not work. Take it as a rough guide to what you are doing