First, you should probably check %killer's score on death that way they're kicked for freekilling, not freekilling then dying.
As for your actual problem,
function GameConnection::onClientLeaveGame(%client)
{
Parent::onClientLeaveGame(%client);
%client.savScore(%client);
}
You're basically saying "Leave the game, then save their score." which, if you think about it, doesn't make any sense. The client will be gone by the time it saves their score. Switch the order of the two calls inside there and it should work.
You should also use %client.setScore($ss::client[%id]); in the gameConnection::loadScore function.
I used your suggestions now. This is what it looks like:
It still doesn't work.
package ss
{
function GameConnection::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc)
{
%client.GameConnection::savScore(%client);
Parent::onDeath(%client, %killerPlayer, %killer, %damageType, %damageLoc);
if (%killer.score < -100)
%killer.delete("You have been kicked because of excessive freekilling.");
if (%client.score < -100)
%client.delete("You have been kicked because of excessive freekilling.");
}
function GameConnection::savScore(%client)
{
%id = %client.bl_id;
$ss::client[%id] = %client.score; //example: $ss::client30621 = 10
}
function GameConnection::onPlayerSpawn(%client)
{
Parent::onPlayerSpawn(%client);
%client.GameConnection::loadScore(%client);
}
function Gameconnection::loadScore(%client)
{
%id = %client.bl_id;
%client.setScore($ss::client[%id]);
}
function GameConnection::onClientLeaveGame(%client)
{
Parent::onClientLeaveGame(%client);
%client.GameConnection::savScore(%client);
}
};
activatePackage(ss);