reconnect server crash

Started by Coolkid, Mar 09, 2016, 03:22 AM

Previous topic - Next topic

Coolkid

hi all
my problem is when i try to reconnect the server show that the name already exists and kicks the player and crashes here are the scrren shots
http://imgur.com/a/SHKiu

My stats function
[spoiler]function SaveStats( player )
{
try{
local id = player.ID;
if ( (status[ id ].IsReg == true) && (status[ id ].IsLogged == true) )
{
QuerySQL( db, "UPDATE Account SET Kills='" + status[ id ].Kills + "', Killeds='" + status[ id ].Killeds + "', Deaths='" + status[ player.ID ].Deaths + "', Cash='" + status[ id ].Cash + "', Bank='" + status[ id ].Bank + "', Joins='" + status[id].Joins + "' WHERE Name='" + player.Name.tolower() + "'" );
print( "Saved Stats of Player " + player.Name + "[" + player.ID + "]" );
status[ id ] = null;
}
}
catch(e) print( "Save Stats Error: " + e );
}
function onPlayerPart( player, reason )
{
local Text = "Unknown";
switch ( reason )
{
case PARTREASON_QUIT:
Text = "Quit";
break;
case PARTREASON_DISCONNECTED:
Text = "Leaving";
break;
case PARTREASON_TIMEOUT:
Text = "Timeout";
break;
case PARTREASON_KICKED:
Text = "Kicked";
break;
case PARTREASON_BANNED:
Text = "Banned";
break;
case PARTREASON_CRASHED:
Text = "Game-Crashed";
break;
}
EchoMessage(ICOL_RED+ICOL_BOLD+"** >> ID:[ "+player.ID+" ] "+player.Name+" Has Left The Server.("+Text+")");
Message(RED+"** >> ID:[ "+GetTeamToRGB(player.Team)+""+player.ID+""+RED+" ] "+GetTeamToRGB(player.Team)+""+player.Name+" "+ORANGE+"Has Left The Server."+ORANGE+"("+Text+")");
print("** ID:[ "+player.ID+" ] "+player.Name+" Has Left The Server.("+Text+")");
if ( status[ player.ID ].PHidden == true ) status[ player.ID ].PHidden = false;
if ( status[ player.ID ].chat == 1 ) status[ player.ID ].chat = 0;
{
EndKillingSpree(player,255);
SetPlayerSpree(player);
menuRageQuit( player );
SaveStats( player );
savespawnwep(player.Name,player.ID);
}
for (local i = g_FPS.len()-1; i >= 0; i--)
{if (g_FPS[i].Player.ID == player.ID)
{if (g_FPS[i].Text != null) g_FPS[i].Text.Delete();
g_FPS.remove(i);
break;}
}
for (local i = g_DIS.len()-1; i >= 0; i--)
{if (g_DIS[i].Player.ID == player.ID)
{if (g_DIS[i].Dist != null) g_DIS[i].Dist.Delete();
g_DIS.remove(i);
break;}
}
for (local i = g_ST.len()-1; i >= 0; i--)
{if (g_ST[i].Player.ID == player.ID)
{if (g_ST[i].ST != null) g_ST[i].ST.Delete();
g_ST.remove(i);
break;}
}
for (local i = g_DM.len()-1; i >= 0; i--)
{if (g_DM[i].Player.ID == player.ID)
{if (g_DM[i].DM != null) g_DM[i].DM.Delete();
g_DM.remove(i);
break;}
}
if ( GetPlayers()-1 == 0 )
{
speedometer.Paused = true;
timer_status = false;
}
if ( GetPlayers()-1 == 0 )
{
secretgate.Paused = true;
sec_status = false;
}
if ( GetPlayers()-1 == 0 )
{
armygate.Paused = true;
army_status = false;
}
if(player.World==1){
if(Max[player.ID]==true){
WorldCounter[1]-=1;
if(WorldCounter[1]==-1){WorldCounter[1]=0;}}
}
if(player.World==2){
if(Max[player.ID]==true){
WorldCounter[2]-=1;
if(WorldCounter[2]==-1){WorldCounter[2]=0;}}
}
if(SpawnKill[player.ID]==true){SpawnKill[ player.ID ]=false;}
}
[/spoiler]