Index: Daodan/MSVC/Daodan_Utility.c
===================================================================
--- Daodan/MSVC/Daodan_Utility.c	(revision 578)
+++ Daodan/MSVC/Daodan_Utility.c	(revision 579)
@@ -176,21 +176,4 @@
 }
 
-void* ScoreboardInstance = 0;
-void FLrRun_Scores()
-{
-
-	if(!ScoreboardInstance){
-		void* TSFFTahoma;
-		TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma);
-		TSrContext_New( TSFFTahoma, 7, 1, 1,  0, &ScoreboardInstance);
-	}
-	if(ScoreboardInstance){
-		int white = 0x00FFFFFF;
-		IMtPoint2D DrawLocation = {20, 20};
-		TSrContext_SetShade(ScoreboardInstance, white);
-		TSrContext_DrawText(ScoreboardInstance, "Scores and crap", 255, 0, &DrawLocation);	
-	}
-}
-
 void ONICALL DDrText_Hook()
 {
Index: Daodan/MSVC/Flatline.c
===================================================================
--- Daodan/MSVC/Flatline.c	(revision 578)
+++ Daodan/MSVC/Flatline.c	(revision 579)
@@ -1,5 +1,7 @@
 #include "Flatline.h"
 #include "Oni_Character.h"
+#include "Flatline_Client.h"
 #include "Flatline_Server.h"
+#include "Flatline_Events.h"
 //#include <sys/time.h>
 #include <time.h>
@@ -456,5 +458,7 @@
 			}
 			break;
-			
+		case FLATLINE_EVENT:
+			FLcEventHandler( packet.flatline_event.event_index, packet.flatline_event.intArray );
+			break;
 		default:
 			DDrConsole_PrintF("Warning, recieved badly formed packet!");
@@ -502,11 +506,5 @@
 {
 	uint16_t i;
-		/*DDrConsole_PrintF("Current: %x %x | Start: %x %x | Stop: %x %x | Stopped %x %x", 
-		ONgGameState->Input.Current.Actions1, ONgGameState->Input.Current.Actions2,
-		ONgGameState->Input.Start.Actions1,ONgGameState->Input.Start.Actions2,
-		ONgGameState->Input.Stop.Actions1, ONgGameState->Input.Stop.Actions2,
-		ONgGameState->Input.Stopped.Actions2, ONgGameState->Input.Stopped.Actions2
-		);
-	*/	
+
 	ActiveCharacter * Active_Player = ONgGameState->ActiveCharacters;
 	Active_Player->PhyContext->Rotation;
@@ -514,23 +512,4 @@
 	ONgGameState->PlayerCharacter->Position;
 
- 
-	
-	/*
-	if( ONgGameState->Input.MouseDeltaX != 0 || ONgGameState->Input.MouseDeltaY != 0 ||
-		ONgGameState->Input.field_8 != 0 || ONgGameState->Input.field_C != 0 )
-
-	DDrConsole_PrintF("%f %f | %f %f",
-		ONgGameState->Input.MouseDeltaX , ONgGameState->Input.MouseDeltaY,
-		ONgGameState->Input.field_8, ONgGameState->Input.field_C);
-
-		*/
-	//if sprint timer is equal to 0, display 0
-	//else if sprint timer is equal to -1, display -1
-	//else display difference
-	//good thing this is just quick an dirty debug stuff :)
-
-	//basically it seems that if the difference is bigger than 15 frames, you cant dash. : /
-	
-#ifndef SPAM_INPUT
 	if(client_connected) 
 	{
@@ -548,14 +527,6 @@
 		//return ONgGameState;
 	}
-#endif
-	//Testing drawing text to the screen...this failed. Will need to get it working eventually.
-	if( TSrTest )
-	{
-//		OniRectangle TextRect = { 128, 128, 256, 256 };
-		IMtPoint2D Point = {50, 50};
-		//TSrContext_DrawText(TSrTest, "Testing woohoo", 255, 0, &Point);
-		TSrContext_DrawText(TSrTest, "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW", 255, 0, &Point);	
-		
-	}
+
+
 	if(!(server_started || client_connected)) return ONgGameState;
 
@@ -566,7 +537,47 @@
 		if(PlayerList[i] == 0) continue;
 		
-		//is this right?
+		
 		Player = PlayerList[i]->Chr;
-		Active_Player = (void*)ONrGetActiveCharacter( PlayerList[i]->Chr);
+		if( Player->Health == 0) 
+		{
+			int Actions;
+			const short TicksToRespawn = 3 * 60;
+			if(PlayerList[i]->state != STATE_DEAD)
+			{
+				PlayerList[i]->state = STATE_DEAD;
+				PlayerList[i]->DeathTime = ONgGameState->GameTime;
+				if(i == client_slot)
+				{
+					ONrGameState_Timer_Start( "", TicksToRespawn  );
+				}
+			}
+
+			if(server_started & i == 0)
+			{
+				Actions =  ONgGameState->Input.Current.Actions1;
+			}
+			else
+			{
+				Actions = PlayerList[i]->Actions1;
+			}
+
+			if(PlayerList[i]->flags & PF_SCRIPTEDAI)
+			{
+				FLrPlayerDisconnect( i );
+			}
+			else if(ONgGameState->GameTime - PlayerList[i]->DeathTime < TicksToRespawn )
+			{
+				continue;
+			}
+			else if(Actions & (Action_Punch | Action_Kick))
+			{
+				FLrPlayerRespawn( i );
+			}
+			continue;
+				
+			
+		}
+
+		Active_Player = ONrGetActiveCharacter( PlayerList[i]->Chr);
 		
 		if(Active_Player == 0) continue;
@@ -576,5 +587,5 @@
 			flatline_packet data_out = {0};
 
-			//if( PlayerList[i]->Chr->Health == 0) PlayerList[i]->Chr->Health = PlayerList[i]->Chr->MaxHealth;
+			
 
 			data_out.id = PLAYER_DATA;
@@ -592,11 +603,8 @@
 			if(Active_Player->targetThrow)
 			{
-				data->throw_data.throwing = Active_Player->throwing;
+				data->throw_data.throwing = Players[Active_Player->throwing].list_slot;
 				memcpy(data->throw_data.throwName, TMrInstance_GetInstanceName(Active_Player->targetThrow), 31);
 				data->throw_data.throwFrame = ONrGetActiveCharacter(Active_Player->targetThrow)->Frame;
-				
-			}
-			
-
+			}
 			
 			
@@ -631,21 +639,4 @@
 		if( (server_started && i !=0)  || (!server_started/* && i != client_slot*/) ) 
 		{
-			//this just made sync even worse...
-#ifdef JITTER_FIX
-			input_struct * New_Input = &PlayerList[i]->MouseDeltaX;
-			input_struct * Cache_Input = &PlayerList[i]->CacheInput;
-			Active_Input->Stop.Actions1 = ~Cache_Input->Actions1 & Active_Input->Current.Actions1;
-			Active_Input->Stop.Actions2 = ~Cache_Input->Actions2 & Active_Input->Current.Actions2;
-			Active_Input->Start.Actions1 = ~Active_Input->Current.Actions1 & Cache_Input->Actions1;
-			Active_Input->Start.Actions2 = ~Active_Input->Current.Actions2 & Cache_Input->Actions2;
-			Active_Input->Current.Actions1 = Cache_Input->Actions1;
-			Active_Input->Current.Actions2 = Cache_Input->Actions2;
-			Active_Input->Stopped.Actions1 = ~Active_Input->Current.Actions1;
-			Active_Input->Stopped.Actions2 = ~Active_Input->Current.Actions2;
-			Active_Input->MouseDeltaX = Cache_Input->MouseDeltaX;
-			Active_Input->MouseDeltaY = Cache_Input->MouseDeltaY;
-			memcpy( Cache_Input, New_Input, sizeof(input_struct));
-#else
-	
 			Active_Input->Stop.Actions1 = ~PlayerList[i]->Actions1 & Active_Input->Current.Actions1;
 			Active_Input->Stop.Actions2 = ~PlayerList[i]->Actions2 & Active_Input->Current.Actions2;
@@ -659,21 +650,6 @@
 			Active_Input->MouseDeltaX = PlayerList[i]->MouseDeltaX;
 			Active_Input->MouseDeltaY = PlayerList[i]->MouseDeltaY;
-			//DDrConsole_PrintF("Timer: %i", (Active_Player->SprintTimer != 0) ? (Active_Player->SprintTimer == -1) ? -1 : (ONgGameState->GameTime - Active_Player->SprintTimer) : 0);
-
-			//DDrConsole_PrintF("1E8 %u", ONgGameState->PlayerCharacter->field_1E8);
-/*
-			DDrConsole_PrintF("T %u | Current: %x %x | Start: %x %x | Stop: %x %x | Stopped %x %x", 
-				PlayerList[i]->LastInputTime,
-				Active_Input->Current.Actions1, Active_Input->Current.Actions2,
-				Active_Input->Start.Actions1,Active_Input->Start.Actions2,
-				Active_Input->Stop.Actions1, Active_Input->Stop.Actions2,
-				Active_Input->Stopped.Actions1, Active_Input->Stopped.Actions2
-		);
-		*/
-			
-		
-#endif
-
-#ifdef BETTER_SYNC
+
+
 			if( !server_started && PlayerList[i]->player_data.Health != 0) {
 				void* OldAnimation;
@@ -763,6 +739,6 @@
 				if (PlayerList[i]->player_data.throw_data.throwName[0] != 0)
 				{
-					if ((pd->throw_data.throwing != 0xFFFF) &&
-						(pd->throw_data.throwing != Active_Player->throwing) &&
+					pd->throw_data.throwing = PlayerList[pd->throw_data.throwing]->spawnnumber;
+					if ((pd->throw_data.throwing != Active_Player->throwing) &&
 						(pd->throw_data.throwFrame < 10))
 					{
@@ -801,6 +777,4 @@
 
 			}
-#endif
-
 		}
 	}
@@ -808,2 +782,77 @@
 	return ONgGameState;
 }
+
+void FLrPlayerDisconnect( int Player )
+{
+	if(server_started)
+	{
+		//FLsPublic_Event(EV_DISCONNECT, &Player );
+	}
+	//Kill off the character in another function, please
+	//ONrCharacter_SetHitPoints(  PlayerList[Player]->Chr, 0);
+	
+	memset(PlayerList[Player], 0, sizeof(player_info));
+	PlayerList[Player] = 0;
+	
+
+
+	return;
+}
+
+void FLrPlayerRespawn( int Player )
+{
+	PlayerList[Player]->state = STATE_ALIVE;
+	ONrCorpse_Create(PlayerList[Player]->Chr);
+	ONrCharacter_SetHitPoints(  PlayerList[Player]->Chr, PlayerList[Player]->Chr->MaxHealth );
+}
+
+
+void* ScoreboardInstance = 0;
+void FLrRun_Scores()
+{
+	if(client_connected || server_started)
+	{
+		if(!ScoreboardInstance){
+			void* TSFFTahoma;
+			TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma);
+			TSrContext_New( TSFFTahoma, 7, 1, 1,  0, &ScoreboardInstance);
+		}
+		if(ScoreboardInstance){
+			const int white =	0x00FFFFFF;
+			const int green =	0x0000FF00;
+			const int red =		0x00FF0000;
+			int i;
+			char DrawString[255];
+			const int LineHeight = 15;
+			IMtPoint2D DrawLocation = {20, 20};
+			TSrContext_SetShade(ScoreboardInstance, white);
+			TSrContext_DrawText(ScoreboardInstance, "Oni Flatline build " __DATE__ " " __TIME__, 255, 0, &DrawLocation);
+			DrawLocation.y += LineHeight;
+			TSrContext_DrawText(ScoreboardInstance, "Name", 255, 0, &DrawLocation);
+			DrawLocation.x += 150;
+			TSrContext_DrawText(ScoreboardInstance, "Score", 255, 0, &DrawLocation);
+			for(i = 0; i <MAX_PLAYERS; i++)
+			{
+				if(PlayerList[i] == 0) continue;
+
+				DrawLocation.x = 20;
+				DrawLocation.y += LineHeight;
+				
+				if(PlayerList[i]->Chr->Health == 0) 
+				{
+					TSrContext_SetShade(ScoreboardInstance, red);
+				}
+				else if (i == client_slot)
+				{
+					TSrContext_SetShade(ScoreboardInstance, green);
+				}
+				TSrContext_DrawText(ScoreboardInstance, PlayerList[i]->Chr->Name, 255, 0, &DrawLocation);
+				TSrContext_SetShade(ScoreboardInstance, white);
+				DrawLocation.x += 150;
+				sprintf(DrawString, "%i", PlayerList[i]->Chr->Damage);
+				TSrContext_DrawText(ScoreboardInstance, DrawString, 255, 0, &DrawLocation);
+
+			}
+		}
+	}
+}
Index: Daodan/MSVC/Flatline.h
===================================================================
--- Daodan/MSVC/Flatline.h	(revision 578)
+++ Daodan/MSVC/Flatline.h	(revision 579)
@@ -174,5 +174,5 @@
 
 enum {
-	NULL_PACKET, //
+	NULL_PACKET, //Don't use. ;)
 	CONNECT_SEND,
 	CONNECT_REPLY,
@@ -227,4 +227,5 @@
 	uint16_t state;
 	int flags;
+	int DeathTime;
 } player_info;
 
@@ -250,5 +251,6 @@
 extern char player_name[];
 void FLrRun_Scores();
-void PlayerDisconnect( int Player );
+void FLrPlayerDisconnect( int Player );
+void FLrPlayerRespawn( int Player );
 int FLrEvent_GetNumArgs( int eventIndex );
 #endif
Index: Daodan/MSVC/Flatline_BSL.c
===================================================================
--- Daodan/MSVC/Flatline_BSL.c	(revision 578)
+++ Daodan/MSVC/Flatline_BSL.c	(revision 579)
@@ -128,5 +128,6 @@
 uint16_t ONICALL kick(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
 {
-	PlayerDisconnect(args[0].value_int32);
+	FLrPlayerDisconnect(args[0].value_int32 - 1);
+	FLsPublic_Event(EV_DISCONNECT, &args[0].value_int32);
 	return 0;
 }
Index: Daodan/MSVC/Flatline_Server.c
===================================================================
--- Daodan/MSVC/Flatline_Server.c	(revision 578)
+++ Daodan/MSVC/Flatline_Server.c	(revision 579)
@@ -124,20 +124,20 @@
 }
 
+//FLsPublic_Event
 //Sends an event (door opening, player disconnecting, etc) to all players
 //Always make sure you send a pointer to this, even if it is just one arg. ;)
-void FLsPublic_Event( unsigned int eventIndex, int * args )
+//Returns 0 because mixing C and assembly is stupid.
+//If it is void the double door in State crashes. Probably stack corruption,
+//I'm not sure exactly why.
+int FLsPublic_Event( const unsigned int eventIndex, const int * args )
 {
 	int numArgs = FLrEvent_GetNumArgs( eventIndex );
+	int ret;
 	flatline_packet eventPacket = {0};
 	eventPacket.id = FLATLINE_EVENT;
 	eventPacket.flatline_event.event_index = eventIndex;
-	memcpy( eventPacket.flatline_event.intArray, args, sizeof(int) * numArgs );
-	UDPServer_SendToAll( &eventPacket, sizeof(int) * (numArgs + 1) + FLATLINE_HEADER );
+	ret = memcpy( eventPacket.flatline_event.intArray, args, sizeof(int) * numArgs );
+	ret = UDPServer_SendToAll( &eventPacket, sizeof(int) * (numArgs + 1) + FLATLINE_HEADER );
+	return 0;
 }
 
-void PlayerDisconnect( int Player )
-{
-	FLsPublic_Event(EV_DISCONNECT, &Player );
-	memset(PlayerList[Player], 0, sizeof(player_info));
-	return;
-}
Index: Daodan/MSVC/Flatline_Server.h
===================================================================
--- Daodan/MSVC/Flatline_Server.h	(revision 578)
+++ Daodan/MSVC/Flatline_Server.h	(revision 579)
@@ -9,5 +9,5 @@
 extern uint16_t max_connections;
 player_info* FLrServer_AddPlayer(int ip, char* name, bool is_server, bool is_bot);
-void FLsPublic_Event( unsigned int eventIndex, int * args);
+int FLsPublic_Event( const unsigned int eventIndex, const int * args);
 
 void FLrServer_Initialize();
Index: Daodan/MSVC/Oni_Symbols.c
===================================================================
--- Daodan/MSVC/Oni_Symbols.c	(revision 578)
+++ Daodan/MSVC/Oni_Symbols.c	(revision 579)
@@ -184,4 +184,5 @@
 DefFunc( OBJrConsole_OnActivate					, 0x004C0880 );
 DefFunc( ONrCharacter_SetAnimationExternal		, 0x004EB340 );
+DefFunc( ONrGameState_Timer_Start				, 0x004FD370 );
 #define DefVar(type, name, address) //type* _##name = (type*)address
 
Index: Daodan/MSVC/Oni_Symbols.h
===================================================================
--- Daodan/MSVC/Oni_Symbols.h	(revision 578)
+++ Daodan/MSVC/Oni_Symbols.h	(revision 579)
@@ -124,5 +124,5 @@
 	void		*ioTextContext,
 	uint32_t	inShade);
-
+typedef void (* _ONrGameState_Timer_Start)( char* function, int time );
 typedef uint16_t ( *_TRrAnimation_GetDuration)(void* Animation);
 typedef uint16_t ( *_TRrAnimation_GetTo)(void* Animation);
@@ -170,5 +170,5 @@
 ExtFunc(TRrAnimation_GetFrom);
 ExtFunc(TRrAnimation_GetTo); 
-
+ExtFunc(ONrGameState_Timer_Start);
 extern _UUrMachineTime_High UUrMachineTime_High;
 extern _UUrMachineTime_High_Frequency UUrMachineTime_High_Frequency;
