Crash

Started by rObInX, Feb 18, 2015, 06:39 PM

Previous topic - Next topic

rObInX

Server crashes when using a timer.
Codes:
if ( CheckBan( player ) == 1 ) NewTimer( "Kick", 5000, 1, player );
function Kick( player )
{
  EMessage( "** [" + player.ID + "] " + player.Name + " has left the server( KICKED )." );
  player.Kick();
}


Thijn

Known bug: https://bitbucket.org/stormeus/0.4-squirrel/issue/9/some-types-of-data-crash-timers

Use a wrapper function and pass an player ID instead of instance.

Locked.

Stormeus

#2
I just want to point out that this would crash your server anyway if the player left in the five seconds it takes to kick them.

You can check if a player is still online by using a timer with player.ID instead of player, then using this in your Kick function:
function Kick(playerID) {
    local player = FindPlayer(playerID);
    if (player == null) {
        return;
    }

    EMessage( [...]