I dont see any error there, but can you try to comment lines out and see, if it still triggers the error?
Printable View
I dont see any error there, but can you try to comment lines out and see, if it still triggers the error?
Only 8 years late to the thread... I'm working on a similar mod but for S&D gametype. The problem is that player.money is set to 0 each round because PlayerConnect is being called after each spawn. No clue on that...
I've solved it by saving the money into server cvars, but doesn't seem like an elegant solution.
Anyone has a better idea?
You can try storing money in global variables, I don’t know how good this idea is :)
PHP Code:
getID()
{
return self getEntityNumber();
}
onPlayerConnect()
{
id = self getID();
level.money[id] = 0;
}
onPlayerDisconnect()
{
id = self getID();
level.money[id] = undefined;
}
Killed(/*...*/)
{
if (mod == "headshot")
money = 100;
else if (mod == "melee")
money = 200;
else
money = 50;
id = self getID();
level.money[id] += money;
}
Bad idea. The level var is also cleaned (except for level.game array) on round restart. Furthermore, since players go through the "playerconnecting" callback when the round restarts, their money gets reset using this technique.
Just store in player.pers["money"] or something similar. Look at the stock sd gametype for .pers["kills"] for example.