[Solved]something like onPlayerDisconnect()?
Hey there,
so i want to set the same killstreaks for each player. I've done that with setPlayerData().
Of course i saved the original values for each player before changing it, so i could restore them. The problem is, i don't know when to call the restore function. When i "force" it manually, the code works, but i want it to automatically get called when a player leaves the game, or the game ends (not sure if this counts as the same, since the player leaves the game when it ends).
So i tried something like:
where restore() gets called as a level thread on host connect (it works if i set it to waittill onplayercommand(blabla) ).
This is also how the onPlayerDisconnect function is written (forgot in what gsc, but i think it is in skill.gsc for example)
I also tried
But that does not work either.
The only that is working, is when the game ends (it ends under special circumstances), with
Anyone got ideas on how to accomplish this?
thx
greetz
so i want to set the same killstreaks for each player. I've done that with setPlayerData().
Of course i saved the original values for each player before changing it, so i could restore them. The problem is, i don't know when to call the restore function. When i "force" it manually, the code works, but i want it to automatically get called when a player leaves the game, or the game ends (not sure if this counts as the same, since the player leaves the game when it ends).
So i tried something like:
Code:
restore()
{
for(;;)
{
level waittill( "disconnected", player);
player restoreKillstreaks();
}
}
This is also how the onPlayerDisconnect function is written (forgot in what gsc, but i think it is in skill.gsc for example)
I also tried
Code:
level waittill_any("disconnected","disconnect","leaving","game_ended");
The only that is working, is when the game ends (it ends under special circumstances), with
Code:
level thread maps\mp\gametypes\_gamelogic::forceEnd(); foreach(player in level.players) player restoreKillstreaks();
thx
greetz


