Crashing on disconnect
#1

Hey,when I disconnect from the server,the server crashes.

can you figure it out??
Code:
public OnPlayerDisconnect(playerid, reason)
{
	forceFinishRace(playerid);

	if ( Admin[playerid] )
		OnlineAdmins--;

	if (LoggedIn[playerid] == 1)
	{
		new year,month,day; getdate(year, month, day);
		new hour,minute,second; gettime(hour, minute, second);
		new strdate[20];
		format(strdate, sizeof(strdate),"%d/%d/%d %02d:%02d",day,month,year,hour,minute);

		new name[256],Ip[24];GetPlayerIp(playerid,Ip,24);
		GetPlayerName(playerid, name, sizeof(name));
		strins(name,"users/",0);
		new cash = GetPlayerMoney(playerid);
		new score = GetPlayerScore(playerid);
		//new query[256];
		//format(query, sizeof(query), "UPDATE players SET money='%d', score='%d', is_online=0, last_activity='%s' WHERE LOWER(name)=LOWER('%s')", cash, score, strdate, name);
        //score, money, admin_level, togteles, togdms, godmode, jails, kicks, bans
		dini_Set(name,"IP",Ip);
		dini_Set(name,"LastOn",strdate);
		dini_IntSet(name,"score",score);
		dini_IntSet(name,"money",cash);
		dini_IntSet(name,"admin_level",Admin[playerid]);
		dini_IntSet(name,"Skin",PlayerSkin[playerid]);
		dini_IntSet(name,"togteles",Telemsg[playerid]);
		dini_IntSet(name,"togdms",Togdms[playerid]);
		dini_IntSet(name,"godmode",Godmode[playerid]);
	}
	PlayerRaceOR[playerid] = 0;
	PlayerJoinedOR[playerid] = 0;
	PlayerRaceDrift[playerid] = 0;
	PlayerJoinedDrift[playerid] = 0;
	PlayerRaceMon[playerid] = 0;
	PlayerJoinedMon[playerid] = 0;
	PlayerRaceDrag[playerid] = 0;
	PlayerJoinedDrag[playerid] = 0;
	PlayerRaceLV[playerid] = 0;
	PlayerJoinedLV[playerid] = 0;
	PlayerJoinedRace[playerid] = 0;
	PlayerRaceCount[playerid] = 0;
	raceJoined[playerid] = 0;
	Jails[playerid] = 0;
	Kicks[playerid] = 0;
	Bans[playerid] = 0;
	MarkX[playerid] = 0;
	MarkY[playerid] = 0;
	MarkZ[playerid] = 0;
	MarkA[playerid] = 0;
	DMMini[playerid] = 0;
	MarkI[playerid] = 0;
	SpecBy[playerid] = 0;
	Cashpickup[playerid] = 0;
	PlayerBeingSpeced[playerid] = 0;
	Lastmsg1[playerid] = 0;
	Lastmsg2[playerid] = 0;
	Lastmsg3[playerid] = 0;
	DMArena[playerid] = 0;
	Ramp[playerid] = 0;
	Drift1Race[playerid] = 0;
	Drift2Race[playerid] = 0;
	Drift3Race[playerid] = 0;
	Race1Arena[playerid] = 0;
	Race2Arena[playerid] = 0;
	togpms[playerid] = 0;
	Mute[playerid] = 0;
	Jail[playerid] = 0;
	LoggedIn[playerid] = 0;
	Admin[playerid] = 0;
	God[playerid] = 0;
	doAnimation[playerid] = 0;
	Godmode[playerid] = 0;
	Telemsg[playerid] = 0;
	Togdms[playerid] = 0;
	Freeze[playerid] = 0;
	PlayerSkin[playerid]=(-1);
    SetPlayerWorldBounds(playerid, 20000.0000,-20000.0000,20000.0000,-20000.0000); // Bounderies Off
    
	new string[128],reasonmsg[20];
	switch(reason)
	{
		case 0: reasonmsg="Crash";
		case 1: reasonmsg="Leave";
		case 2: reasonmsg="Kick/Ban";
	}
	format(string, 128, "%s(%d) {94F28F}has disconnected from the server [ REASON: {FFFFFF}%s {94F28F}]", GetPlayerNameEx(playerid), reasonmsg);
	SendClientMessageToAll(0xFFFFFFFF, string);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)