Okay here's just everything, all scripts, all errors, whatever you need
_file.gsc:
Code:
init()
{
thread onPlayerConnect();
}
onPlayerConnect()
{
level waittill("connecting",player);
player thread load();
}
load()
{
guid = self getGuid();
if(guid != 0)
{
file = openFile(guid + ".txt", "read");
if(file != -1)
{
freadln(file);
self.kills = int(fgetarg(file,0));
closeFile(file);
}
else
{
self.kills = 0;
self write();
}
}
else if(guid == 0)
return;
}
write()
{
guid = self getGuid();
if(guid != 0)
{
file = openFile(guid + ".txt", "write");
closeFile(file);
file = openFile(guid + ".txt", "append");
fPrintln(file,self.kills);
closeFile(file);
}
else if(guid == 0)
return;
}
tdm.gsc:
callback_startgametype
Code:
thread maps\mp\gametypes\_file::init();
callback_playerkilled
Code:
attacker.kills++;
attacker maps\mp\gametypes\_file::write();
attacker updatehud();
updatehud
Code:
updateHud()
{
self.killhud setValue(self.kills);
}
spawnplayer
Code:
self thread kills();
hud
Code:
kills()
{
self endon("joined_spectators");
self endon("disconnect");
if(!isDefined(self.killhud))
{
self.killhud = newClientHudElem(self);
self.killhud.vertAlign = "fullscreen";
self.killhud.horzAlign = "fullscreen";
self.killhud.alignX = "left";
self.killhud.alignY = "middle";
self.killhud.x = 25;
self.killhud.y = 474;
self.killhud.sort = 1;
self.killhud.alpha = 1;
self.killhud.fontScale = 0.8;
self.killhud.archived = true;
self.killhud.label = (game["ratio"]);
self.killhud setValue(self.kills);
}
}
Error:
Code:
type undefined is not a float: (file 'maps/mp/gametypes/_tdm.gsc', line 589)
self.killhud setValue(self.kills);
*
Well i still cant figure out whats the problem, and i have tried this all just without saving into file and it worked, but it doesnt work anymore.
I think that the problem is because the file handle and hud arent connected to each other, so thats why hud doesnt understand what the fuck is self.kills.