A weird mysql (crashdetect) crash detection. So annoying af
#2

Here is my OnQueryFinish callback
Код:
public OnQueryFinish(query[], resultid, extraid, connectionHandle) {
	new
	    szQuery[2048];
	    
	switch(resultid) {
	    case THREAD_CONFIRM_USERNAME: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
	        if(mysql_fetch_int(g_MySQLConnections[0]) == 0) { // MySQL confirmed the COUNT(*) result is 0; no account with that username exists yet.
	            mysql_free_result(g_MySQLConnections[0]);
	            ShowMainMenuDialog(extraid, 2);
	            
	            gPlayerAccount[extraid] = 0;
	        } else {
	            mysql_free_result(g_MySQLConnections[0]);
	            ShowMainMenuDialog(extraid, 1);
	            gPlayerAccount[extraid] = 1;
		  	}
	    }
	    case THREAD_CHECK_NAME_PASSWORD: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
	        if(mysql_num_rows(g_MySQLConnections[0]) > 0) {
	            new
	                szPassword[64],
	                szTarget[MAX_PLAYER_NAME],
					szBuffer[129];

				GetPVarString(extraid, "opasschange", szPassword, sizeof(szPassword));
				GetPVarString(extraid, "opasschangetarget", szTarget, sizeof(szTarget));
				
				WP_Hash(szBuffer, sizeof(szBuffer), szPassword);

		        format(szQuery, sizeof(szQuery), "UPDATE players SET Password = '%s' WHERE Username = '%s'", szBuffer, szTarget);
		        mysql_query(szQuery, THREAD_FULLY_CHANGE_PASSWORD, extraid, g_MySQLConnections[0]);
	        } else {
				DeletePVar(extraid, "opasschange");
				DeletePVar(extraid, "opasschangetarget");
				SendClientMessage(extraid, COLOR_GREY, "The player account name specified doesn't exist or currently has admin.");
			}
	        
	        mysql_free_result(g_MySQLConnections[0]);
	    }
		case THREAD_LIST_NAMECHANGES: {
		    mysql_store_result(g_MySQLConnections[0]);
		    
		    if(mysql_num_rows(g_MySQLConnections[0]) > 0) {
		        // Use 'szQuery' because of the large size of the string at our disposal
		        format(szQuery, sizeof(szQuery), "");
		        
		        new
		            szPlayerName[MAX_PLAYER_NAME],
		            szPlayerOldName[MAX_PLAYER_NAME],
		            szPlayerAdminName[MAX_PLAYER_NAME],
					szMessage[1000],
					iUnixTS;
		        
		        format(szMessage, sizeof(szMessage), "Listing the last 10 namechanges for %s:\n", GetPlayerNameEx(GetPVarInt(extraid, "namechanges_target")));
		        
	        	while(mysql_fetch_row_format(szQuery, "|", g_MySQLConnections[0])) {
					sscanf(szQuery, "p<|>s[MAX_PLAYER_NAME]ds[MAX_PLAYER_NAME]s[MAX_PLAYER_NAME]", szPlayerOldName, iUnixTS, szPlayerName, szPlayerAdminName);
					
					format(szMessage, sizeof(szMessage), "%s\n%s is now known as %s (as of %s) and his namechange was approved of by %s", szMessage, szPlayerOldName, szPlayerName, timec(iUnixTS), szPlayerAdminName);
				}
				
				DeletePVar(extraid, "namechanges_target");
				
				ShowPlayerDialogEx(extraid, DIALOG_SHOW_NAMECHANGES, DIALOG_STYLE_MSGBOX, "List of namechanges", szMessage, "OK", "");
		    } else {
				SendClientMessage(extraid, COLOR_GREY, "There are no namechanges registered for this player.");
				DeletePVar(extraid, "namechanges_target");
		    }
		    
		    mysql_free_result(g_MySQLConnections[0]);
		}
	    case THREAD_FULLY_CHANGE_PASSWORD: {
	        new
	            szMessage[128],
				szTarget[MAX_PLAYER_NAME];
	            
            GetPVarString(extraid, "opasschangetarget", szTarget, sizeof(szTarget));
            
     		format(szMessage, sizeof(szMessage), "You have changed %s's password.", szTarget);
	        SendClientMessage(extraid, COLOR_YELLOW, szMessage);

	        format(szMessage, sizeof(szMessage), "AdmCmd: %s's password was changed by %s", szTarget, GetPlayerNameEx(extraid));
	        Log("logs/password.log", szMessage);
	        ABroadCast(COLOR_LIGHTRED, szMessage, 1);
	        
	        DeletePVar(extraid, "opasschange");
	        DeletePVar(extraid, "opasschangetarget");
		}
	    case THREAD_CHECK_NEW_NAME: {
			mysql_store_result(g_MySQLConnections[0]);
			
			if(mysql_num_rows(g_MySQLConnections[0]) > 0) {
			    SendClientMessage(GetPVarInt(extraid, "requestby"), COLOR_GREY, "The requested name is already taken.");
			    if(GetPVarInt(extraid, "requestpath") == 1) {
					SendClientMessage(extraid, COLOR_GREY, "The name you requested has already been taken, please select another.");
					ShowPlayerDialogEx(extraid, DIALOG_NAMECHANGE2, DIALOG_STYLE_INPUT, "Free name change","This is a roleplay server where you must have a name in this format: Firstname_Lastname.\nFor example: John_Smith or Jimmy_Johnson\n\nAn admin has offered you to change your name to the correct format for free. Please enter your desired name below.\n\nNote: If you press cancel you will be kicked from the server.", "Change", "Cancel");
				} else if(GetPVarInt(extraid, "requestpath") == 2) {
				    SendClientMessage(extraid, COLOR_GREY, "The name you requested has already been taken. Try again?");

					DeletePVar(extraid, "requestpath");
					DeletePVar(extraid, "NewNameRequest");
					DeletePVar(extraid, "NameChangeCost");
					DeletePVar(extraid, "requestby");
					DeletePVar(extraid, "requestedname");
					DeletePVar(extraid, "RequestingNameChange");
				} else if(GetPVarInt(extraid, "requestpath") == 3) {
					SendClientMessage(GetPVarInt(extraid, "requestby"), COLOR_GREY, "That name is already taken.");
					DeletePVar(extraid, "requestedname");
					DeletePVar(extraid, "requestpath");
					DeletePVar(extraid, "requestby");
				}
			} else {
			    new
			        szPlayerName[MAX_PLAYER_NAME];
			        
				GetPVarString(extraid, "requestedname", szPlayerName, MAX_PLAYER_NAME);
				
				format(szQuery, sizeof(szQuery), "UPDATE players SET Username = '%s' WHERE ID = %d", szPlayerName, PlayerInfo[extraid][pID]);
				mysql_query(szQuery, THREAD_CONFIRMED_NAMECHANGE, extraid, g_MySQLConnections[0]);
			}
			
			mysql_free_result(g_MySQLConnections[0]);
		}
		case THREAD_CONFIRMED_NAMECHANGE: {
  			new
				szPlayerName[MAX_PLAYER_NAME],
				szOriginalPlayerName[MAX_PLAYER_NAME],
				string[128];

			GetPVarString(extraid, "requestedname", szPlayerName, MAX_PLAYER_NAME);
			GetPlayerName(extraid, "szOriginalPlayerName", MAX_PLAYER_NAME);
			
            if(GetPVarInt(extraid, "requestpath") == 1) {
				format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has approved %s's request to become %s", GetPlayerNameEx(GetPVarInt(extraid, "requestby")), GetPlayerNameEx(extraid), szPlayerName);
				ABroadCast(COLOR_YELLOW, string, 2);
				format(PlayerInfo[extraid][pFlag], 128, "");
			} else if(GetPVarInt(extraid, "requestpath") == 2) {
				format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has approved %s's request to become %s", GetPlayerNameEx(GetPVarInt(extraid, "requestby")), GetPlayerNameEx(extraid), szPlayerName);
				ABroadCast(COLOR_YELLOW, string, 2);
			} else {
				format(string, sizeof(string), "%s has set %s's name to %s.",GetPlayerNameEx(GetPVarInt(extraid, "requestby")), GetPlayerNameEx(extraid), szPlayerName);
				ABroadCast(COLOR_YELLOW, string, 1);
			}

			if(PlayerInfo[extraid][pHouse] != INVALID_HOUSE_ID && strcmp(szOriginalPlayerName, HouseInfo[PlayerInfo[extraid][pHouse]][hOwner], true) == 0) {
				strmid(HouseInfo[PlayerInfo[extraid][pHouse]][hOwner], szPlayerName, 0, strlen(szPlayerName), 255);
     			format(string, sizeof(string), "House owner: %s\nLevel: %d\nID: %d",HouseInfo[PlayerInfo[extraid][pHouse]][hOwner],HouseInfo[PlayerInfo[extraid][pHouse]][hLevel],PlayerInfo[extraid][pHouse]);
         		UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[extraid][pHouse]][hTextID], COLOR_HOUSEGREEN, string);
			}

			if(PlayerInfo[extraid][pHouse2] != INVALID_HOUSE_ID && strcmp(szOriginalPlayerName, HouseInfo[PlayerInfo[extraid][pHouse2]][hOwner], true) == 0) {
				strmid(HouseInfo[PlayerInfo[extraid][pHouse2]][hOwner], szPlayerName, 0, strlen(szPlayerName), 255);
    			format(string, sizeof(string), "House owner: %s\nLevel: %d\nID: %d",HouseInfo[PlayerInfo[extraid][pHouse]][hOwner],HouseInfo[PlayerInfo[extraid][pHouse]][hLevel],PlayerInfo[extraid][pHouse]);
     			UpdateDynamic3DTextLabelText(HouseInfo[PlayerInfo[extraid][pHouse2]][hTextID], COLOR_HOUSEGREEN, string);
			}

			if(PlayerInfo[extraid][pDonator] >= 1) {
				format(string, sizeof(string), "[DONATOR NAMECHANGES] %s has changed their name to %s.", GetPlayerNameEx(extraid), szPlayerName);
				Log("logs/donatornames.log", string);
			}

			format(string, sizeof(string), " Your name has been changed from %s to %s.", GetPlayerNameEx(extraid), szPlayerName);
			SendClientMessage(extraid, COLOR_YELLOW, string);

			format(string, sizeof(string), "%s changed \"%s\"s name to \"%s\"",GetPlayerNameEx(GetPVarInt(extraid, "requestby")), GetPlayerNameEx(extraid), szPlayerName);
			Log("logs/stats.log", string);
			
			if(AdminDuty[extraid] == 0) {			
				format(szQuery, sizeof(szQuery), "INSERT INTO namechanges (dbid, oldname, newname, approvedbyid, approvedbyname, unixts) VALUES(%d, '%s', '%s', %d, '%s', %d)", PlayerInfo[extraid][pID], GetPlayerNameEx(extraid), szPlayerName, PlayerInfo[GetPVarInt(extraid, "requestby")][pID], GetPlayerNameEx(GetPVarInt(extraid, "requestby")), gettime());
				mysql_query(szQuery, THREAD_NO_RESULT, 0, g_MySQLConnections[0]);
			}

			SetPlayerName(extraid, szPlayerName);
			
			if(GetPVarInt(extraid, "NameChangeCost") > 0)
				PlayerInfo[extraid][pCash] -= GetPVarInt(extraid, "NameChangeCost");

			PlayerInfo[extraid][pInt] = GetPlayerInterior(extraid);

			if(GetPVarType(extraid, "tabbedVW") != 0) {
				PlayerInfo[extraid][pVW] = GetPVarInt(extraid, "tabbedVW");
			} else PlayerInfo[extraid][pVW] = GetPlayerVirtualWorld(extraid);

			GetPlayerIp(extraid, PlayerInfo[extraid][pIP], 32);
			GetPlayerPos(extraid, PlayerInfo[extraid][pPos_x], PlayerInfo[extraid][pPos_y], PlayerInfo[extraid][pPos_z]);
			GetPlayerFacingAngle(extraid, PlayerInfo[extraid][pPos_r]);
			SaveAccount(extraid);
			
			DeletePVar(extraid, "requestby");
			DeletePVar(extraid, "requestedname");
			DeletePVar(extraid, "requestpath");
			DeletePVar(extraid, "NewNameRequest");
			DeletePVar(extraid, "NameChangeCost");
			DeletePVar(extraid, "RequestingNameChange");
		}
	    case THREAD_GIVE_REF_TOKENS: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
	        if(mysql_num_rows(g_MySQLConnections[0]) == 0)
	            return SendClientMessage(extraid, COLOR_YELLOW, "The player who referred you here no longer has an account and has not been given their referral token.");

			new
			    iTokens = mysql_fetch_int(g_MySQLConnections[0]) + 1;

			format(szQuery, sizeof(szQuery), "UPDATE players SET RefTokensOffline = %d WHERE Username = '%s'", iTokens, PlayerInfo[extraid][pReferredBy]);
			mysql_query(szQuery, THREAD_LITERALLY_GIVE_REFTOKEN, extraid, g_MySQLConnections[0]);

            mysql_free_result(g_MySQLConnections[0]);
		}
		case THREAD_OFFLINE_FLAG: {
	        mysql_store_result(g_MySQLConnections[0]);

	        if(mysql_num_rows(g_MySQLConnections[0]) == 0)
	            return SendClientMessage(extraid, COLOR_GREY, "That account doesn't exist!");

			new
			    szFlag[128],
			    szFormattedFlag[128],
			    szPlayerName[MAX_PLAYER_NAME];

			GetPVarString(extraid, "offline_flag", szFlag, sizeof(szFlag));
			GetPVarString(extraid, "offline_flag_target", szPlayerName, sizeof(szPlayerName));

			new month,day,year;
			getdate(year,month,day);
			format(szFormattedFlag, sizeof(szFormattedFlag), "%s - %s (%d/%d/%d)", szFlag, GetPlayerNameEx(extraid), day, month, year);
			
			format(szQuery, sizeof(szQuery), "UPDATE players SET Flag = '%s' WHERE Username = '%s'", szFormattedFlag, szPlayerName);
			mysql_query(szQuery, THREAD_NO_RESULT, 0, g_MySQLConnections[0]);
				
			// Avoid defining a new string, use one that's already clear to go.
			format(szFormattedFlag, sizeof(szFormattedFlag), "AdmCmd: %s has flagged %s, reason: %s.", GetPlayerNameEx(extraid), szPlayerName, szFlag);
			ABroadCast(COLOR_LIGHTRED, szFormattedFlag, 1);
			
			DeletePVar(extraid, "offline_flag");
			DeletePVar(extraid, "offline_flag_target");
				
    		mysql_free_result(g_MySQLConnections[0]);
		}
		case THREAD_OFFLINE_UNINVITE: {
		    mysql_store_result(g_MySQLConnections[0]);
		    
	        if(mysql_num_rows(g_MySQLConnections[0]) == 0)
	            return SendClientMessage(extraid, COLOR_YELLOW, "That account doesn't exist!");

			if(mysql_retrieve_row()) {
			    new
			        szReturn[6];
			        
            	mysql_fetch_field_row(szReturn, "AdminLevel", g_MySQLConnections[0]);
            	
            	if(strval(szReturn) >= 5)
            	    return SendClientMessage(extraid, COLOR_YELLOW, "This player can't be uninvited by you. ");

                mysql_fetch_field_row(szReturn, "Faction", g_MySQLConnections[0]);
                
                if(strval(szReturn) != PlayerInfo[extraid][pFaction])
                	return SendClientMessage(extraid, COLOR_YELLOW, "This player isn't in the same faction as you.");
                	
				new
				    szPlayerName[MAX_PLAYER_NAME];

				GetPVarString(extraid, "uninvite_target", szPlayerName, MAX_PLAYER_NAME);
				format(szQuery, sizeof(szQuery), "UPDATE players SET Faction = 0, Rank = 0, On‌Duty = 0, Leader = 0, Skin = 299 WHERE Username = '%s'", szPlayerName);
				mysql_query(szQuery, THREAD_FULLY_UNINVITE, extraid, g_MySQLConnections[0]);
				
				mysql_free_result(g_MySQLConnections[0]);
            }
		    
		}
		case THREAD_FULLY_UNINVITE: {
			new
			    szPlayerName[MAX_PLAYER_NAME],
			    szMessage[128];

			GetPVarString(extraid, "uninvite_target", szPlayerName, MAX_PLAYER_NAME);
			
			format(szMessage, sizeof(szMessage), "You have kicked %s from the faction.", szPlayerName);
			SendClientMessage(extraid, COLOR_LIGHTBLUE, szMessage);
			
            format(szMessage, sizeof(szMessage), "%s has uninvited %s from the %s.", GetPlayerNameEx(extraid), szPlayerName, GetFactionName(PlayerInfo[extraid][pFaction]));
			Log("logs/faction.log", szMessage);
			
			DeletePVar(extraid, "uninvite_target");
		}
		case THREAD_LITERALLY_GIVE_REFTOKEN: {
		    new
		        string[123];
		        
			format(string, sizeof(string), "Since you have reached 8 playing hours and were referred by %s, they have gained 1 referral token.", PlayerInfo[extraid][pReferredBy]);
   			SendClientMessage(extraid, COLOR_YELLOW, string);
		}
	    case THREAD_REFERRAL_MENU: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
	        if(mysql_num_rows(g_MySQLConnections[0]) == 0) {
	            format(PlayerInfo[extraid][pReferredBy], MAX_PLAYER_NAME, "");
                ShowPlayerDialogEx(extraid, REGISTRATION_MENU_FOUR, DIALOG_STYLE_INPUT, "{FFA500}Stratum Roleplay - Registration", "{FFFFFF}ENTRY DECLINED: There is no player registered by that name.\n\nWhat is the name of the player that referred you?\n\nNote: It must be the full player name with underscore ('_'). For example: John_Smith", "Done", "Cancel");
	        } else {
	            mysql_free_result(g_MySQLConnections[0]);
	            
				new
				    string[128];

	            format(string, sizeof(string), "{FFFFFF}Are you sure you were referred by %s?", PlayerInfo[extraid][pReferredBy]);
	            ShowPlayerDialogEx(extraid, REGISTRATION_MENU_FIVE, DIALOG_STYLE_MSGBOX, "{FFA500}Stratum Roleplay - Registration", string, "Yes", "No");
	        }
		}
		case THREAD_MDC_CHECK: {
			if(mysql_num_rows(g_MySQLConnections[0]) == 0) { // No rows exist with the specified criteria, so, wrong password!
				mysql_free_result(g_MySQLConnections[0]);
				ShowPlayerDialogEx(extraid, MDC_END_ID, DIALOG_STYLE_MSGBOX, "SA-MDC - Logged in | ERROR ", "There is no record of that person.", "OK", "Cancel");
			} else {
				mysql_store_result(g_MySQLConnections[0]);
				new
					crimeDescription[128],
					crimeIssuerName[MAX_PLAYER_NAME],
					crimeIssuedToName[MAX_PLAYER_NAME],
					szFullMessage[1028],
					iSlot = 0;
				
				while(mysql_retrieve_row()) {
					iSlot++;
					switch(iSlot) {
						case 1: {
							mysql_fetch_field_row(crimeDescription, "crimeDescription", g_MySQLConnections[0]);
							mysql_fetch_field_row(crimeIssuerName, "crimeIssuerName", g_MySQLConnections[0]);
							mysql_fetch_field_row(crimeIssuedToName, "crimeIssuedToName", g_MySQLConnections[0]);
							if(!isnull(crimeDescription)) {
								format(szFullMessage, sizeof(szFullMessage), "Name: %s", crimeIssuedToName);
								format(szFullMessage, sizeof(szFullMessage), "%s\n %s - %s", szFullMessage, crimeDescription, crimeIssuerName);
							}
						}
						case 2, 3, 4, 5, 6: {
							mysql_fetch_field_row(crimeDescription, "crimeDescription", g_MySQLConnections[0]);
							mysql_fetch_field_row(crimeIssuerName, "crimeIssuerName", g_MySQLConnections[0]);
							if(!isnull(szFullMessage) && !isnull(crimeDescription)) {
								format(szFullMessage, sizeof(szFullMessage), "%s\n %s - %s", szFullMessage, crimeDescription, crimeIssuerName);
							}
						}
					}
				}
				for(new i=0; i < MAX_PLAYERVEHICLES; i++) {
					if(PlayerVehicleInfo[GetPVarInt(extraid, "MDCCHECK")][i][pvTicket] != 0)
					{
						format(szFullMessage, sizeof(szFullMessage), "%s\n Vehicle registration: %d | Vehicle Name: %s | Ticket: $%d.\n",szFullMessage, PlayerVehicleInfo[GetPVarInt(extraid, "MDCCHECK")][i][pvId],GetVehicleName(PlayerVehicleInfo[GetPVarInt(extraid, "MDCCHECK")][i][pvId]),PlayerVehicleInfo[GetPVarInt(extraid, "MDCCHECK")][i][pvTicket]);
					}
				}
				ShowPlayerDialogEx(extraid, MDC_END_ID, DIALOG_STYLE_LIST, "SA-MDC - Logged in | Criminal History", szFullMessage, "OK", "Cancel");
				DeletePVar(extraid, "MDCCHECK");
				mysql_free_result(g_MySQLConnections[0]);
			}
		}
	    case THREAD_OFFLINE_KILLS: {
			mysql_store_result(g_MySQLConnections[0]);
			if(IsPlayerConnected(extraid)) {
				if(mysql_num_rows(g_MySQLConnections[0]) == 0) { // No rows exist with the specified criteria, so, wrong password!
		            mysql_free_result(g_MySQLConnections[0]);
					SendClientMessage(extraid, COLOR_GREY, "The specified player account doesn't exist.");
		        } else {
					mysql_retrieve_row();
					
					new
					    szPlayerName[MAX_PLAYER_NAME],
						szReturn[128],
						iPlayerID;

                    mysql_fetch_field_row(szPlayerName, "Username", g_MySQLConnections[0]);
					mysql_fetch_field_row(szReturn, "ID", g_MySQLConnections[0]);
				    iPlayerID = strval(szReturn);
					mysql_free_result(g_MySQLConnections[0]);
					
					SendClientMessage(extraid, COLOR_GREEN, "________________________________________________");
					format(szReturn, sizeof(szReturn), "<< Last 10 Kills of %s >>", szPlayerName);
					SendClientMessage(extraid, COLOR_YELLOW, szReturn);
					
					format(szQuery, sizeof(szQuery), "SELECT kills.* FROM kills INNER JOIN players ON kills.killerID = players.ID OR kills.killedID = players.ID WHERE players.ID = '%d' ORDER BY kills.killTS ASC LIMIT 10", iPlayerID);
					mysql_query(szQuery, THREAD_OFFLINE_KILLS_2, extraid, g_MySQLConnections[0]);
				}	
			}	
	    }
	    case THREAD_OFFLINE_KILLS_2: {
			mysql_store_result(g_MySQLConnections[0]);
			new
				KillLog[128],
				iSlot = 0;
				
			while(mysql_retrieve_row()) {
				iSlot++;
				switch(iSlot) {
					case 9: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 8: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 7: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 6: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 5: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 4: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 3: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 2: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 1: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
					case 0: {
						mysql_fetch_field_row(KillLog, "killText", g_MySQLConnections[0]);
						if(!isnull(KillLog)) SendClientMessage(extraid, COLOR_YELLOW, KillLog);
					}
				}
			}
			mysql_free_result(g_MySQLConnections[0]);
		}
	    case THREAD_GET_STATS: {
	        mysql_store_result(g_MySQLConnections[0]);
			if(IsPlayerConnected(extraid)) {
			    new
			        szReturn[128];

		        if(mysql_num_rows(g_MySQLConnections[0]) == 0) { // No rows exist with the specified criteria, so, wrong password!
		            mysql_free_result(g_MySQLConnections[0]);
					SendClientMessage(extraid, COLOR_GREY, "The specified player account doesn't exist.");
		        } else {
		            mysql_retrieve_row();

					new facgang[20], employer[64], rank[64], division[64], jtext[20], jtext2[20];
					
					mysql_fetch_field_row(szReturn, "Level", g_MySQLConnections[0]);
				    new level = strval(szReturn);
				    
				    mysql_fetch_field_row(szReturn, "ConnectTime", g_MySQLConnections[0]);
				    new phours = strval(szReturn);
				    
				    mysql_fetch_field_row(szReturn, "Respect", g_MySQLConnections[0]);
					new respect = strval(szReturn);
					
					new nxtlevel = level + 1;
					new expamount = nxtlevel*levelexp;
					new costlevel = nxtlevel*2500;
					
					mysql_fetch_field_row(szReturn, "PhoneNumber", g_MySQLConnections[0]);
					new pnumber = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Warnings", g_MySQLConnections[0]);
					new warns = strval(szReturn);

					facgang = "Faction";
					employer = "None";
					rank = "None";
					
					mysql_fetch_field_row(szReturn, "Gang", g_MySQLConnections[0]);
					new iGang = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Rank", g_MySQLConnections[0]);
					new iRank = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Division", g_MySQLConnections[0]);
					new iDivision = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Faction", g_MySQLConnections[0]);
					new iFaction = strval(szReturn);
					
					if(iGang < 255) {
					    facgang = "Family";
						division = "None";
						
						format(employer, sizeof(employer), "%s", FamilyInfo[iGang][FamilyName]);
						switch(iRank) {
							case 1: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank1]);
							case 2: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank2]);
							case 3: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank3]);
							case 4: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank4]);
							case 5: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank5]);
				  			case 6: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank6]);
							default: format(rank, sizeof(rank), "%s", FamilyInfo[iGang][FamilyRank1]);
						}
					}
					else {
					    PlayerInfo[MAX_PLAYERS][pDivision] = iDivision;
					    PlayerInfo[MAX_PLAYERS][pRank] = iRank;
					    PlayerInfo[MAX_PLAYERS][pFaction] = iFaction;
					    
			            GetPlayerFactionInfo(MAX_PLAYERS, rank, division, employer);
					}
					
					mysql_fetch_field_row(szReturn, "Job", g_MySQLConnections[0]);
					new iJob = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Job2", g_MySQLConnections[0]);
					new iJob2 = strval(szReturn);
					
					switch(iJob)
					{
						case 1: jtext = "Detective";
						case 2: jtext = "Lawyer";
						case 3: jtext = "Whore";
						case 4: jtext = "Drugs Dealer";
						case 5: jtext = "Car Jacker";
						//case 6: jtext = "News Reporter";
						case 7: jtext = "Car Mechanic";
						case 8: jtext = "Bodyguard";
						case 9: jtext = "Arms Dealer";
						//case 10: jtext = "Car Dealer";
						case 12: jtext = "Boxer";
						case 14: jtext = "Drug Smuggler";
						//case 15: jtext = "Paper Boy";
						//case 16: jtext = "Trucker";
						case 17: jtext = "Taxi Driver";
						case 18: jtext = "Craftsman";
						case 19: jtext = "Bartender";
						case 20: jtext = "Trucker";
						case 21: jtext = "Pizza Boy";
						default: jtext = "None";
					}
					switch(iJob2)
					{
						case 1: jtext2 = "Detective";
						case 2: jtext2 = "Lawyer";
						case 3: jtext2 = "Whore";
						case 4: jtext2 = "Drugs Dealer";
						case 5: jtext2 = "Car Jacker";
						//case 6: jtext2 = "News Reporter";
						case 7: jtext2 = "Car Mechanic";
						case 8: jtext2 = "Bodyguard";
						case 9: jtext2 = "Arms Dealer";
						//case 10: jtext2 = "Car Dealer";
						case 12: jtext2 = "Boxer";
						case 14: jtext2 = "Drug Smuggler";
						//case 15: jtext2 = "Paper Boy";
						//case 16: jtext2 = "Trucker";
						case 17: jtext2 = "Taxi Driver";
						case 18: jtext2 = "Craftsman";
						case 19: jtext2 = "Bartender";
						case 20: jtext2 = "Trucker";
						case 21: jtext2 = "Pizza Boy";
						default: jtext2 = "None";
					}
					
					new jlevel;
					switch(iJob)
					{
						case 1:
						{
								mysql_fetch_field_row(szReturn, "DetSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 2:
						{
								mysql_fetch_field_row(szReturn, "LawSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 3:
						{
								mysql_fetch_field_row(szReturn, "SexSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 4:
						{
								mysql_fetch_field_row(szReturn, "DrugsSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 5:
						{
								mysql_fetch_field_row(szReturn, "CarSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
				  		case 7:
						{
								mysql_fetch_field_row(szReturn, "MechSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 9:
						{
								mysql_fetch_field_row(szReturn, "ArmsSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel < 50) { jlevel = 1; }
								else if(skilllevel >= 50 && skilllevel < 100) { jlevel = 2; }
								else if(skilllevel >= 100 && skilllevel < 200) { jlevel = 3; }
								else if(skilllevel >= 200 && skilllevel < 400) { jlevel = 4; }
								else if(skilllevel >= 400) { jlevel = 5; }
						}
						case 12:
						{
								mysql_fetch_field_row(szReturn, "BoxSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 14:
						{
								mysql_fetch_field_row(szReturn, "SmugSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						case 20:
						{
								mysql_fetch_field_row(szReturn, "TruckSkill", g_MySQLConnections[0]);
								new skilllevel = strval(szReturn);
								if(skilllevel >= 0 && skilllevel <= 50) { jlevel = 1; }
								else if(skilllevel >= 51 && skilllevel <= 100) { jlevel = 2; }
								else if(skilllevel >= 101 && skilllevel <= 200) { jlevel = 3; }
								else if(skilllevel >= 201 && skilllevel <= 400) { jlevel = 4; }
								else if(skilllevel >= 401) { jlevel = 5; }
						}
						default: jlevel = 0;
					}

                    mysql_fetch_field_row(szReturn, "UpgradePoints", g_MySQLConnections[0]);
					new upgrade = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "SpawnArmor", g_MySQLConnections[0]);
					new Float:sarmor = floatstr(szReturn);

                    mysql_fetch_field_row(szReturn, "Cash", g_MySQLConnections[0]);
					new cash = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Bank", g_MySQLConnections[0]);
					new bank = strval(szReturn);
					
					new totalwealth = cash + bank;

					mysql_fetch_field_row(szReturn, "Insurance", g_MySQLConnections[0]);
					new iInsurance = strval(szReturn);

					new insur[20];
					switch(iInsurance)
					{
						case 1: insur = "County General";
						case 2: insur = "All Saints";
						default: insur = "None";
					}

                    mysql_fetch_field_row(szReturn, "Crimes", g_MySQLConnections[0]);
					new crimes = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Arrested", g_MySQLConnections[0]);
					new arrests = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "WantedLevel", g_MySQLConnections[0]);
					new wanted = strval(szReturn);

					new Float:health, Float:armor;
					
					mysql_fetch_field_row(szReturn, "Health", g_MySQLConnections[0]);
					health = floatstr(szReturn);
					
					mysql_fetch_field_row(szReturn, "Armor", g_MySQLConnections[0]);
					armor = floatstr(szReturn);

                    mysql_fetch_field_row(szReturn, "Pot", g_MySQLConnections[0]);
					new pot = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Crack", g_MySQLConnections[0]);
					new crack = strval(szReturn);

                    mysql_fetch_field_row(szReturn, "RadioFreq", g_MySQLConnections[0]);
					new radiofreq = strval(szReturn);

                    mysql_fetch_field_row(szReturn, "Materials", g_MySQLConnections[0]);
					new mats = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Rope", g_MySQLConnections[0]);
					new rope = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Cigars", g_MySQLConnections[0]);
					new cigars = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Sprunk", g_MySQLConnections[0]);
					new sprunk = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Spraycan", g_MySQLConnections[0]);
					new spray = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "BiggestFish", g_MySQLConnections[0]);
					new bigfish = strval(szReturn);

					// Eight line (admin only)
					mysql_fetch_field_row(szReturn, "House", g_MySQLConnections[0]);
					new house = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Renting", g_MySQLConnections[0]);
					new rent = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Interior", g_MySQLConnections[0]);
					new interior = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "VirtualWorld", g_MySQLConnections[0]);
					new vw = strval(szReturn);
					new realvw = vw;
					
					mysql_fetch_field_row(szReturn, "JailTime", g_MySQLConnections[0]);
					new jtime = strval(szReturn);
					
					new
					    szPlayerName[MAX_PLAYER_NAME];

                    mysql_fetch_field_row(szPlayerName, "Username", g_MySQLConnections[0]);

					// Added
					new married[20];
					mysql_fetch_field_row(married, "MarriedTo", g_MySQLConnections[0]);

                    mysql_fetch_field_row(szReturn, "RefTokens", g_MySQLConnections[0]);
					new reftokens = strval(szReturn);
					
					new sext[16];
					mysql_fetch_field_row(szReturn, "Sex", g_MySQLConnections[0]);
					
					if(strval(szReturn) == 1) { sext = "Male"; } else { sext = "Female"; }
					
					mysql_fetch_field_row(szReturn, "Age", g_MySQLConnections[0]);
					new age = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Donator", g_MySQLConnections[0]);
					new donator = strval(szReturn);
					
					new donatortxt[16];
					if(donator == 0) { donatortxt = "No"; }
					else if(donator == 1) { donatortxt = "Ruby"; }
					else if(donator == 2) { donatortxt = "Sapphire"; }
					else if(donator == 3) { donatortxt = "Diamond"; }
					else { donatortxt = "No"; }

                    mysql_fetch_field_row(szReturn, "NewMutedTotal", g_MySQLConnections[0]);
					new nmutes = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "AdMutedTotal", g_MySQLConnections[0]);
			        new admutes = strval(szReturn);
			        
			        mysql_fetch_field_row(szReturn, "ReportMutedTotal", g_MySQLConnections[0]);
			        new rmutes = strval(szReturn);

                    mysql_fetch_field_row(szReturn, "AdminLevel", g_MySQLConnections[0]);
					new adminlevel = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Banned", g_MySQLConnections[0]);
					new banned = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Permabanned", g_MySQLConnections[0]);
					new permabanned = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Disabled", g_MySQLConnections[0]);
					new disabled = strval(szReturn);

				    SendClientMessage(extraid, COLOR_NEWS,"___________________________________________________________________________________________________");
				    new coordsstring[128];
				    format(coordsstring, sizeof(coordsstring),"%s - (Level: %d) - (Playing hours: %d) - (Gender: %s) - (Age: %d) - (Phone number: %d) - (Warnings: %d)", szPlayerName, level, phours, sext, age, pnumber, warns);
				    SendClientMessage(extraid, COLOR_WHITE, coordsstring);
					format(coordsstring, sizeof(coordsstring),"(%s: %s) - (Rank: %s [%d]) - (Division: %s) - (Job: %s [lvl: %d]) - (Radio freq: %d kHz)", facgang, employer, rank, PlayerInfo[MAX_PLAYERS][pRank], division, jtext, jlevel, radiofreq);
					SendClientMessage(extraid, COLOR_FORSTATS, coordsstring);
			   		format(coordsstring, sizeof(coordsstring),"(Total wealth: $%d) - (Cash: $%d) - (Bank balance: $%d) - (Insurance: %s) - (Married to: %s)", totalwealth, cash, bank, insur, married);
			   		SendClientMessage(extraid, COLOR_WHITE, coordsstring);
					format(coordsstring, sizeof(coordsstring),"(Respect points: %d/%d [$%d]) - (Upgrade Points: %d) - (Spawn armor: %.1f) - (Health: %.1f) - (Armor: %.1f)", respect, expamount, costlevel, upgrade, sarmor, health, armor);
					SendClientMessage(extraid, COLOR_FORSTATS, coordsstring);
			   		format(coordsstring, sizeof(coordsstring),"(Crimes: %d) - (Arrests: %d) - (Wanted Level: %d) - (Materials: %d) - (Pot: %d) - (Crack: %d)", crimes, arrests, wanted, mats, pot, crack);
			   		SendClientMessage(extraid, COLOR_WHITE, coordsstring);
			   		format(coordsstring, sizeof(coordsstring),"(Rope: %d) - (Cigars: %d) - (Sprunk: %d) - (Spray: %d) -  (Biggest fish: %d) - (Referral Tokens: %d) - (Donator: %s)", rope, cigars, sprunk, spray, bigfish, reftokens, donatortxt);
			        SendClientMessage(extraid, COLOR_FORSTATS, coordsstring);
					format(coordsstring, sizeof(coordsstring), "(Admin Level: %d) - (Banned: %d) - (Permabanned: %d) - (Account disabled: %d)", adminlevel, banned, permabanned, disabled);
			  		SendClientMessage(extraid, COLOR_WHITE,coordsstring);
				    format(coordsstring, sizeof(coordsstring), "(House: %d) - (Renting: %d) - (Int: %d) - (VW: %d) - (Real VW: %d) - (Jail: %d secs) - (Mutes: [N: %d] [AD: %d] [R: %d])", house, rent, interior, vw, realvw, jtime, nmutes, admutes, rmutes);
				    SendClientMessage(extraid, COLOR_FORSTATS,coordsstring);
					SendClientMessage(extraid, COLOR_NEWS,"___________________________________________________________________________________________________");
				}
			}

	        mysql_free_result(g_MySQLConnections[0]);
	    }
		case THREAD_OFFLINE_FINE: {
	        mysql_store_result(g_MySQLConnections[0]);

	        new
	            szMessage[128],
	            szPlayerIP[20],
	            iPlayerAdminLevel,
	            iPlayerBanned,
	            szReason[128],
	            iPlayerPermabanned,
	            iCash,
	            iBankAccount,
	            iFinedAmount,
	            szPlayerName[MAX_PLAYER_NAME],
	            szResult[256],
				iTotalCashAfterFine;

	        if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections[0])) {
				sscanf(szResult, "p<|>dddssdd", iPlayerPermabanned, iPlayerBanned, iPlayerAdminLevel, szPlayerName, szPlayerIP, iBankAccount, iCash);

				if(iPlayerPermabanned > 0)
				    return SendClientMessage(extraid, COLOR_GREY, "The specified player is permanently banned.");
				    
				if(iPlayerAdminLevel > 0)
				    return SendClientMessage(extraid, COLOR_GREY, "You can't fine other administrators.");
				    
				GetPVarString(extraid, "ofinereason", szReason, sizeof(szReason));
				mysql_real_escape_string(szReason, szReason, g_MySQLConnections[0]);
				
				iFinedAmount = GetPVarInt(extraid, "ofineamount");
				
				iTotalCashAfterFine = iCash - iFinedAmount;
				format(szQuery, sizeof(szQuery), "UPDATE players SET Cash = %d WHERE Username = '%s'", iTotalCashAfterFine, szPlayerName);
				mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections[0]);

				format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason);
				Log("logs/admin.log", szMessage);
				format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline fined $%d by %s, reason: %s", szPlayerName, iFinedAmount, GetPlayerNameEx(extraid), szReason);
				ABroadCast(COLOR_LIGHTRED,szMessage,1);
	        } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist.");

	        mysql_free_result(g_MySQLConnections[0]);
	    }
	    case THREAD_OFFLINE_BAN: {
	        mysql_store_result(g_MySQLConnections[0]);

	        new
	            szMessage[128],
	            szPlayerIP[20],
	            iPlayerAdminLevel,
	            iPlayerBanned,
	            szReason[128],
	            iPlayerPermabanned,
	            szPlayerName[MAX_PLAYER_NAME],
	            iAccountID,
	            szResult[256];

	        if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections[0])) {
				sscanf(szResult, "p<|>ddds[MAX_PLAYER_NAME]s[20]d", iPlayerPermabanned, iPlayerBanned, iPlayerAdminLevel, szPlayerName, szPlayerIP, iAccountID);

				if(iPlayerPermabanned > 0)
				    return SendClientMessage(extraid, COLOR_GREY, "The specified player is already permanently banned.");
				    
				if(iPlayerAdminLevel > 0)
				    return SendClientMessage(extraid, COLOR_GREY, "You can't ban other administrators.");

				GetPVarString(extraid, "obanreason", szReason, sizeof(szReason));
				mysql_real_escape_string(szReason, szReason, g_MySQLConnections[0]);

				AddBan(szPlayerIP);

				format(szMessage, sizeof(szMessage), "AdmCmd: %s (IP: %s) was offline banned by %s, reason: %s", szPlayerName, szPlayerIP, GetPlayerNameEx(extraid), szReason);
				Log("logs/ban.log", szMessage);
				ABroadCast(COLOR_LIGHTRED, szMessage, 1);

				format(szQuery, sizeof(szQuery), "UPDATE players SET Banned = 1 WHERE Username = '%s'", szPlayerName);
				mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections[0]);
				punishmentLogEx(iAccountID, PlayerInfo[extraid][pID], 4, szMessage, szReason);

				DeletePVar(extraid, "obanreason");
	        } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist.");

	        mysql_free_result(g_MySQLConnections[0]);
	    }
	    case THREAD_OFFLINE_PRISON: {
			mysql_store_result(g_MySQLConnections[0]);

			new
				szMessage[128],
				szPlayerIP[20],
				iPlayerAdminLevel,
				iPlayerPrisonTime,
				iPlayerBanned,
				szReason[128],
				iPlayerPermabanned,
				szPlayerName[MAX_PLAYER_NAME],
				iAccountID,
				szResult[285];

			if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections[0])) {
				sscanf(szResult, "p<|>ddds[20]s[19]d", iPlayerPermabanned, iPlayerBanned, iPlayerAdminLevel, szPlayerName, szPlayerIP, iPlayerPrisonTime, iAccountID);
				print(szResult);

				if(iPlayerPermabanned > 0)
					return SendClientMessage(extraid, COLOR_GREY, "The specified player is already permanently banned.");

				if(iPlayerBanned > 0)
					return SendClientMessage(extraid, COLOR_GREY, "The specified player is already banned.");

				if(iPlayerAdminLevel > 0)
					return SendClientMessage(extraid, COLOR_GREY, "You can't warn other administrators.");

				GetPVarString(extraid, "oprisonreason", szReason, sizeof(szReason));
				mysql_real_escape_string(szReason, szReason, g_MySQLConnections[0]);

                iPlayerPrisonTime = GetPVarInt(extraid, "oprisontime");

				format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline prisoned by %s, reason: %s", szPlayerName, GetPlayerNameEx(extraid), szReason);
				ABroadCast(COLOR_LIGHTRED, szMessage, 1);
				format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline prisoned by %s, reason: %s", szPlayerName, GetPlayerNameEx(extraid), szReason);
				Log("logs/admin.log", szMessage);
                punishmentLogEx(iAccountID, PlayerInfo[extraid][pID], 2, szMessage, szReason);

    			format(szQuery, sizeof(szQuery), "UPDATE players SET Jailed = 3, JailTime = %d, PrisonReason = '%s', PrisonedBy = '%s' WHERE Username = '%s'", iPlayerPrisonTime, szReason, GetPlayerNameExEx(extraid), szPlayerName);
				mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections[0]);

				DeletePVar(extraid, "oprisonreason");
				DeletePVar(extraid, "oprisontime");
			} else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist.");

			mysql_free_result(g_MySQLConnections[0]);
	    }
		case THREAD_OFFLINE_WARN: {
			mysql_store_result(g_MySQLConnections[0]);

			new
				szMessage[128],
				szPlayerIP[20],
				iPlayerAdminLevel,
				iPlayerWarnings,
				iPlayerBanned,
				szReason[128],
				iPlayerPermabanned,
				szPlayerName[MAX_PLAYER_NAME],
				iAccountID,
				szResult[256];

			if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections[0])) {
				sscanf(szResult, "p<|>ddds[24]s[20]dd", iPlayerPermabanned, iPlayerBanned, iPlayerAdminLevel, szPlayerName, szPlayerIP, iPlayerWarnings, iAccountID);
				print(szResult);

				if(iPlayerPermabanned > 0)
					return SendClientMessage(extraid, COLOR_GREY, "The specified player is already permanently banned.");
					
				if(iPlayerBanned > 0)
					return SendClientMessage(extraid, COLOR_GREY, "The specified player is already banned.");

				if(iPlayerAdminLevel > 0)
					return SendClientMessage(extraid, COLOR_GREY, "You can't warn other administrators.");
					
				GetPVarString(extraid, "owarnreason", szReason, sizeof(szReason));
				
				iPlayerWarnings += 1;
				
				if(iPlayerWarnings >= 3) {
					format(szReason, sizeof(szReason), "%s (had 3 warnings)", szReason);
					SetPVarString(extraid, "obanreason", szReason);
				
	    			format(szQuery, sizeof(szQuery), "UPDATE players SET Warnings = %d WHERE Username = '%s'", iPlayerWarnings, szPlayerName);
					mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections[0]);

					punishmentLogEx(iAccountID, PlayerInfo[extraid][pID], 4, szMessage, szReason);
					mysql_real_escape_string(szPlayerName, szPlayerName, g_MySQLConnections[0]);
					
					format(szMessage, sizeof(szMessage), "SELECT Permabanned, Banned, AdminLevel, Username, LastIP FROM players WHERE Username = '%s'", szPlayerName);
					mysql_query(szMessage, THREAD_OFFLINE_BAN, extraid, g_MySQLConnections[0]);
					return 1;
				}
				
				format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline warned by %s, reason: %s", szPlayerName, GetPlayerNameEx(extraid), szReason);
				ABroadCast(COLOR_LIGHTRED, szMessage, 1);
				format(szMessage, sizeof(szMessage), "AdmCmd: %s was offline warned by %s, reason: %s", szPlayerName, GetPlayerNameEx(extraid), szReason);
				Log("logs/admin.log", szMessage);
                punishmentLogEx(iAccountID, PlayerInfo[extraid][pID], 1, szMessage, szReason);

    			format(szQuery, sizeof(szQuery), "UPDATE players SET Warnings = %d WHERE Username = '%s'", iPlayerWarnings, szPlayerName);
				mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections[0]);
				
				DeletePVar(extraid, "owarnreason");
			} else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist.");

			mysql_free_result(g_MySQLConnections[0]);
		}
	    case THREAD_OFFLINE_IP_CHECK: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
	        new
	            szMessage[128],
	            szPlayerIP[20],
	            szPlayerName[MAX_PLAYER_NAME],
	            szResult[256];
	        
	        if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections[0])) {
				sscanf(szResult, "p<|>s[20]s[16]", szPlayerName, szPlayerIP);

				format(szMessage, sizeof(szMessage), "Name: %s | IP: %s", szPlayerName, szPlayerIP);
				SendClientMessage(extraid, COLOR_WHITE, szMessage);
	        } else SendClientMessage(extraid, COLOR_GREY, "The player specified does not exist.");
	        
	        mysql_free_result(g_MySQLConnections[0]);
	    }
	    case THREAD_CHECK_BANNED: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
	        new
	            szResult[128],
	            szMessage[128],
	            szPlayerIP[20],
	            szPlayerName[MAX_PLAYER_NAME],
	            iPlayerBan,
	            iPlayerWarnings,
	            iPlayerPermaban;

			if(mysql_fetch_row_format(szResult, "|", g_MySQLConnections[0])) {
			    sscanf(szResult, "p<|>ddds[16]s[20]", iPlayerBan, iPlayerPermaban, iPlayerWarnings, szPlayerIP, szPlayerName);
				print(szResult);
				
			    if(iPlayerPermaban > 0) {
			        SendClientMessage(extraid, COLOR_GREY, "You can't unban this person in-game, they have been permanently banned.");
			        mysql_free_result(g_MySQLConnections[0]);
			    } else {
			        if(iPlayerBan > 0) {
			            RemoveBan(szPlayerIP);
			            
						format(szMessage, sizeof(szMessage), "AdmCmd: %s (IP: %s) was unbanned by %s.", szPlayerName, szPlayerIP, GetPlayerNameEx(extraid));
						ABroadCast(COLOR_LIGHTRED, szMessage, 1);
						
						format(szMessage, sizeof(szMessage), "AdmCmd: %s (IP: %s) was unbanned by %s.", szPlayerName, szPlayerIP, GetPlayerNameEx(extraid));
						Log("logs/ban.log", szMessage);
						
						if(iPlayerWarnings >= 3) {
							format(szQuery, sizeof(szQuery), "UPDATE players SET Banned = 0, Warnings = 0 WHERE Username = '%s'", szPlayerName);
						} else format(szQuery, sizeof(szQuery), "UPDATE players SET Banned = 0 WHERE Username = '%s'", szPlayerName);
						mysql_query(szQuery, THREAD_NO_RESULT, 0, g_MySQLConnections[0]);
			        } else SendClientMessage(extraid, COLOR_GREY, "The player specified isn't banned.");
			    }
			} else SendClientMessage(extraid, COLOR_GREY, "No rows exist with the criteria specified.");
	        
	        mysql_free_result(g_MySQLConnections[0]);
	    }
	    case THREAD_DELETE_PLAYER_OBJECT: {
	        new
	            string[64],
	            listitem = GetPVarInt(extraid, "deleteObject");
	            
			PlayerToyInfo[extraid][listitem][ptModelID] = 0;
			PlayerToyInfo[extraid][listitem][ptBone] = 1;
			PlayerToyInfo[extraid][listitem][ptRealID] = 0;
			PlayerToyInfo[extraid][listitem][ptPosX] = 0.0;
			PlayerToyInfo[extraid][listitem][ptPosY] = 0.0;
			PlayerToyInfo[extraid][listitem][ptPosZ] = 0.0;
			PlayerToyInfo[extraid][listitem][ptPosX] = 0.0;
			PlayerToyInfo[extraid][listitem][ptPosY] = 0.0;
			PlayerToyInfo[extraid][listitem][ptPosZ] = 0.0;

			format(string, sizeof(string), "You have deleted your toy from slot %d.", listitem);
		    ShowPlayerDialogEx(extraid, 0, DIALOG_STYLE_MSGBOX, "Toy Menu - Removal of Toy", string, "OK", "");
		    
		    DeletePVar(extraid, "deleteObject");
		}
	    case THREAD_LOAD_P_ITEMS_CHAIN_1: {
	        mysql_store_result(g_MySQLConnections[0]);

	        new
	            szReturn[16],
	            iSlot = 0;
	        
	        while(mysql_retrieve_row()) {
	            mysql_fetch_field_row(szReturn, "ID", g_MySQLConnections[0]);
	            PlayerToyInfo[extraid][iSlot][ptRealID] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "ModelID", g_MySQLConnections[0]);
	            PlayerToyInfo[extraid][iSlot][ptModelID] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Bone", g_MySQLConnections[0]);
	            PlayerToyInfo[extraid][iSlot][ptBone] = strval(szReturn);
				
				if(PlayerToyInfo[extraid][iSlot][ptBone] > 18 || PlayerToyInfo[extraid][iSlot][ptBone] < 1) PlayerToyInfo[extraid][iSlot][ptBone] = 1;
	            
				mysql_fetch_field_row(szReturn, "PosX", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptPosX] = floatstr(szReturn);
				
				mysql_fetch_field_row(szReturn, "PosY", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptPosY] = floatstr(szReturn);
				
				mysql_fetch_field_row(szReturn, "PosZ", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptPosZ] = floatstr(szReturn);
				
				mysql_fetch_field_row(szReturn, "RotX", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptRotX] = floatstr(szReturn);
				
				mysql_fetch_field_row(szReturn, "RotY", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptRotY] = floatstr(szReturn);
				
				mysql_fetch_field_row(szReturn, "RotZ", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptRotZ] = floatstr(szReturn);
				
				mysql_fetch_field_row(szReturn, "ScaX", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptScaleX] = floatstr(szReturn);

				mysql_fetch_field_row(szReturn, "ScaY", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptScaleY] = floatstr(szReturn);

				mysql_fetch_field_row(szReturn, "ScaZ", g_MySQLConnections[0]);
				PlayerToyInfo[extraid][iSlot][ptScaleZ] = floatstr(szReturn);
				
				iSlot++;
	        }
	        
	        mysql_free_result(g_MySQLConnections[0]);
	        
	        format(szQuery, sizeof(szQuery), "SELECT playervehicles.* FROM playervehicles INNER JOIN players ON playervehicles.Owner = players.ID WHERE players.ID = '%d' ORDER BY playervehicles.Owner ASC LIMIT %d", PlayerInfo[extraid][pID], MAX_PLAYERVEHICLES);
	        mysql_query(szQuery, THREAD_LOAD_P_ITEMS_CHAIN_2, extraid, g_MySQLConnections[0]);
	    }
	    case THREAD_LOAD_P_ITEMS_CHAIN_2: {
	        mysql_store_result(g_MySQLConnections[0]);

	        new
	            szReturn[16],
	            iSlot = 0;

	        while(mysql_retrieve_row()) {
	            mysql_fetch_field_row(szReturn, "ID", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvRealID] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "PosX", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvPosX] = floatstr(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "PosY", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvPosY] = floatstr(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "PosZ", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvPosZ] = floatstr(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "PosAngle", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvPosAngle] = floatstr(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "ModelID", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvModelId] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "LockType", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvLock] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Locked", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvLocked] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "PaintJob", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvPaintJob] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Color1", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvColor1] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Color2", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvColor2] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Price", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvPrice] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Ticket", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvTicket] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Weapon0", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvWeapons][0] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Weapon1", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvWeapons][1] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Weapon2", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvWeapons][2] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "WepUpgrade", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvWepUpgrade] = strval(szReturn);
	            
	            /*mysql_fetch_field_row(szReturn, "Fuel", g_MySQLConnections[0]);*/
	            PlayerVehicleInfo[extraid][iSlot][pvFuel] = 100.0; //floatstr(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Impound", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvImpounded] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Spawned", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvSpawned] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Disabled", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvDisabled] = strval(szReturn);
	            
	            mysql_fetch_field_row(PlayerVehicleInfo[extraid][iSlot][pvNumberPlate], "NumPlate", g_MySQLConnections[0]);
	            
	            mysql_fetch_field_row(szReturn, "Disabled", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvDisabled] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod0", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][0] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod1", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][1] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod2", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][2] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod3", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][3] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod4", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][4] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod5", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][5] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod6", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][6] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "Mod7", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][7] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "Mod8", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][8] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "Mod9", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][9] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "Mod10", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][10] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "Mod11", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][11] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod12", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][12] = strval(szReturn);

	            mysql_fetch_field_row(szReturn, "Mod13", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][13] = strval(szReturn);
	            
	            mysql_fetch_field_row(szReturn, "Mod14", g_MySQLConnections[0]);
	            PlayerVehicleInfo[extraid][iSlot][pvMods][14] = strval(szReturn);
	            if(AdminLoggedInBefore[extraid] == 0) LoadPlayerVehicles(extraid);
	            CheckPlayerVehicleForDesync(extraid, PlayerVehicleInfo[extraid][iSlot][pvId]);
				
				iSlot++;
	        }

	        mysql_free_result(g_MySQLConnections[0]);

	        format(szQuery, sizeof(szQuery), "SELECT kills.* FROM kills INNER JOIN players ON kills.killerID = players.ID OR kills.killedID = players.ID WHERE players.ID = '%d' ORDER BY kills.killTS ASC LIMIT 10", PlayerInfo[extraid][pID]);
	        mysql_query(szQuery, THREAD_LOAD_P_ITEMS_CHAIN_3, extraid, g_MySQLConnections[0]);
	    }
	    case THREAD_LOAD_P_ITEMS_CHAIN_3: {
	        mysql_store_result(g_MySQLConnections[0]);
	        
     	    new
	        	iSlot = 0;

	        while(mysql_retrieve_row()) {
	            iSlot++;
	            switch(iSlot) {
					case 0: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog0], "killText", g_MySQLConnections[0]);
					case 1: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog1], "killText", g_MySQLConnections[0]);
					case 2: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog2], "killText", g_MySQLConnections[0]);
					case 3: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog3], "killText", g_MySQLConnections[0]);
					case 4: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog4], "killText", g_MySQLConnections[0]);
					case 5: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog5], "killText", g_MySQLConnections[0]);
					case 6: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog6], "killText", g_MySQLConnections[0]);
					case 7: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog7], "killText", g_MySQLConnections[0]);
					case 8: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog8], "killText", g_MySQLConnections[0]);
					case 9: mysql_fetch_field_row(PlayerInfo[extraid][pKillLog9], "killText", g_MySQLConnections[0]);
				}
	        }

	        mysql_free_result(g_MySQLConnections[0]);
	    }
	    case THREAD_SAVE_ACCOUNT_CHAIN_1: {
			format(szQuery, sizeof(szQuery), "UPDATE players SET Job = %d, Job2 = %d, UpgradePoints = %d, SpawnArmor = '%f', Cash = %d, Bank = %d, Insurance = %d, Crimes = %d, Arrested = %d, WantedLevel = %d, Health = '%f', Armor = '%f', \
			Pot = %d, Crack = %d, Radio = %d, RadioFreq = %d, Phonebook = %d, Dice = %d, CDPlayer = %d, Materials = %d, Rope = %d, Cigars = %d, Sprunk = %d, Spraycan = %d, House = %d, House2 = %d, Renting = %d, Interior = %d, VirtualWorld = %d, Jailed = %d WHERE ID = %d",
			PlayerInfo[extraid][pJob], PlayerInfo[extraid][pJob2], PlayerInfo[extraid][gPupgrade], PlayerInfo[extraid][pSarmor], PlayerInfo[extraid][pCash], PlayerInfo[extraid][pBank], PlayerInfo[extraid][pInsurance], PlayerInfo[extraid][pCrimes],
			PlayerInfo[extraid][pArrested], PlayerInfo[extraid][pWantedLevel], PlayerInfo[extraid][pHealth], PlayerInfo[extraid][pArmor], PlayerInfo[extraid][pPot], PlayerInfo[extraid][pCrack], PlayerInfo[extraid][pRadio], PlayerInfo[extraid][pRadioFreq],
			PlayerInfo[extraid][pPhoneBook], PlayerInfo[extraid][pDice], PlayerInfo[extraid][pCDPlayer], PlayerInfo[extraid][pMats], PlayerInfo[extraid][pRope], PlayerInfo[extraid][pCigar], PlayerInfo[extraid][pSprunk], PlayerInfo[extraid][pSpraycan], PlayerInfo[extraid][pHouse],
			PlayerInfo[extraid][pHouse2], PlayerInfo[extraid][pRenting], PlayerInfo[extraid][pInt], PlayerInfo[extraid][pVW], PlayerInfo[extraid][pJailed], PlayerInfo[extraid][pID]);
			
			mysql_query(szQuery, THREAD_SAVE_ACCOUNT_CHAIN_2, extraid, g_MySQLConnections[0]);
	    }
	    case THREAD_SAVE_ACCOUNT_CHAIN_2: {
	        format(szQuery, sizeof(szQuery), "UPDATE players SET JailTime = %d, Gun0 = %d, Gun1 = %d, Gun2 = %d, Gun3 = %d, Gun4 = %d, Gun5 = %d, Gun6 = %d, Gun7 = %d, Gun8 = %d, Gun9 = %d, Gun10 = %d, Gun11 = %d, Paycheck = %d, PayReady = %d, Hospital = %d, \
			DetSkill = %d, FishSkill = %d, LawSkill = %d, DrugsSkill = %d, SmugglerSkill = %d, ArmsSkill = %d, MechSkill = %d, BoxSkill = %d, TruckSkill = %d, CarSkill = %d, LawyerTime = %d, LawyerFreeTime = %d, DrugsTime = %d, MechTime = %d WHERE ID = %d",
			PlayerInfo[extraid][pJailTime], PlayerInfo[extraid][pGuns][0], PlayerInfo[extraid][pGuns][1], PlayerInfo[extraid][pGuns][2], PlayerInfo[extraid][pGuns][3], PlayerInfo[extraid][pGuns][4], PlayerInfo[extraid][pGuns][5], PlayerInfo[extraid][pGuns][6], PlayerInfo[extraid][pGuns][7],
			PlayerInfo[extraid][pGuns][8], PlayerInfo[extraid][pGuns][9], PlayerInfo[extraid][pGuns][10], PlayerInfo[extraid][pGuns][11], PlayerInfo[extraid][pPayCheck], PlayerInfo[extraid][pPayReady], PlayerInfo[extraid][pHospital], PlayerInfo[extraid][pDetSkill], PlayerInfo[extraid][pFishSkill],
			PlayerInfo[extraid][pLawSkill], PlayerInfo[extraid][pDrugsSkill], PlayerInfo[extraid][pSmugSkill], PlayerInfo[extraid][pArmsSkill], PlayerInfo[extraid][pMechSkill], PlayerInfo[extraid][pBoxSkill], PlayerInfo[extraid][pTruckSkill], PlayerInfo[extraid][pCarSkill], PlayerInfo[extraid][pLawyerTime],
			PlayerInfo[extraid][pLawyerFreeTime], PlayerInfo[extraid][pDrugsTime], PlayerInfo[extraid][pMechTime], PlayerInfo[extraid][pID]);
			
			mysql_query(szQuery, THREAD_SAVE_ACCOUNT_CHAIN_3, extraid, g_MySQLConnections[0]);
	    }
	    case THREAD_SAVE_ACCOUNT_CHAIN_3: {
			format(szQuery, sizeof(szQuery), "UPDATE players SET SexTime = %d, CarTime = %d, Fishes = %d, BiggestFish = %d, pWEXists = %d, pWX = '%f', pWY = '%f', pWZ = '%f', pWVW = %d, pWInt = %d, pWValue = %d, pWSeeds = %d, Wins = %d, Loses = %d, \
			FightingStyle = %d, Screwdriver = %d, Wristwatch = %d, Tire = %d, Firstaid = %d, Rccam = %d, Receiver = %d, GPS = %d, Sweep = %d, SweepLeft = %d, Bugged = %d, On‌Duty = %d, CarLic = %d, FlyLic = %d, GunLic = %d, Division = %d WHERE ID = %d",
			PlayerInfo[extraid][pSexTime], PlayerInfo[extraid][pCarTime], PlayerInfo[extraid][pFishes], PlayerInfo[extraid][pBiggestFish], PlayerInfo[extraid][pWeedObject], PlayerInfo[extraid][pWeedPos][0], PlayerInfo[extraid][pWeedPos][1], PlayerInfo[extraid][pWeedPos][2],
			PlayerInfo[extraid][pWeedVW], PlayerInfo[extraid][pWeedInt], PlayerInfo[extraid][pWeedGrowth], PlayerInfo[extraid][pWSeeds], PlayerInfo[extraid][pWins], PlayerInfo[extraid][pLoses], PlayerInfo[extraid][pFightStyle], PlayerInfo[extraid][pScrewdriver],
			PlayerInfo[extraid][pWristwatch], PlayerInfo[extraid][pTire], PlayerInfo[extraid][pFirstaid], PlayerInfo[extraid][pRccam], PlayerInfo[extraid][pReceiver], PlayerInfo[extraid][pGPS], PlayerInfo[extraid][pSweep], PlayerInfo[extraid][pSweepLeft],
			PlayerInfo[extraid][pBugged], PlayerInfo[extraid][pDuty], PlayerInfo[extraid][pCarLic], PlayerInfo[extraid][pFlyLic], PlayerInfo[extraid][pGunLic], PlayerInfo[extraid][pDivision], PlayerInfo[extraid][pID]);

			mysql_query(szQuery, THREAD_SAVE_ACCOUNT_CHAIN_4, extraid, g_MySQLConnections[0]);
	    }
	    case THREAD_SAVE_ACCOUNT_CHAIN_4: {
	        // Escape strings for now....
	        new
	            szPrisonedBy[MAX_PLAYER_NAME],
	            szPrisonReason[128],
	            szContractBy[MAX_PLAYER_NAME],
	            szContractDetail[128];
	            
			mysql_real_escape_string(PlayerInfo[extraid][pPrisonedBy], szPrisonedBy, g_MySQLConnections[0]);
			mysql_real_escape_string(PlayerInfo[extraid][pPrisonReason], szPrisonReason, g_MySQLConnections[0]);
			
			mysql_real_escape_string(PlayerInfo[extraid][pContractBy], szContractBy, g_MySQLConnections[0]);
			mysql_real_escape_string(PlayerInfo[extraid][pContractDetail], szContractDetail, g_MySQLConnections[0]);

			format(szQuery, sizeof(szQuery), "UPDATE players SET TicketTime = %d, HeadValue = %d, ContractBy = '%s', ContractDetail = '%s', Bombs = %d, CHits = %d, FHits = %d, PrisonedBy = '%s', PrisonReason = '%s', AcceptReport = %d, TrashReport = %d, Accent = %d, \
			NewMuted = %d, NewMutedTotal = %d, AdMuted = %d, AdMutedTotal = %d, ReportMuted = %d, ReportMutedTotal = %d, ReportMutedTime = %d, Speedo = %d, GCMuted = %d, GCMutedTime = %d, CallsAccepted = %d, PatientsDelivered = %d WHERE ID = %d",
			PlayerInfo[extraid][pTicketTime], PlayerInfo[extraid][pHeadValue], szContractBy, szContractDetail, PlayerInfo[extraid][pBombs], PlayerInfo[extraid][pCHits], PlayerInfo[extraid][pFHits], szPrisonedBy, szPrisonReason,
			PlayerInfo[extraid][pAcceptReport], PlayerInfo[extraid][pTrashReport], PlayerInfo[extraid][pAccent], PlayerInfo[extraid][pNMute], PlayerInfo[extraid][pNMuteTotal], PlayerInfo[extraid][pADMute], PlayerInfo[extraid][pADMuteTotal], PlayerInfo[extraid][pRMuted], PlayerInfo[extraid][pRMutedTotal],
			PlayerInfo[extraid][pRMutedTime], PlayerInfo[extraid][pSpeedo], PlayerInfo[extraid][pGCMuted], PlayerInfo[extraid][pGCMutedTime], PlayerInfo[extraid][pCallsAccepted], PlayerInfo[extraid][pPatientsDelivered], PlayerInfo[extraid][pID]);

			mysql_query(szQuery, THREAD_SAVE_ACCOUNT_CHAIN_5, extraid, g_MySQLConnections[0]);
	    } 
	    case THREAD_SAVE_ACCOUNT_CHAIN_5: {
	        // Escape more strings...
	        new
	            szMarriedTo[MAX_PLAYER_NAME],
	            szFlag[128],
	            szReferredBy[MAX_PLAYER_NAME];
	            
			mysql_real_escape_string(PlayerInfo[extraid][pMarriedTo], szMarriedTo, g_MySQLConnections[0]);
			mysql_real_escape_string(PlayerInfo[extraid][pFlag], szFlag, g_MySQLConnections[0]);
			mysql_real_escape_string(PlayerInfo[extraid][pReferredBy], szReferredBy, g_MySQLConnections[0]);
			
			format(szQuery, sizeof(szQuery), "UPDATE players SET SMSLog = %d, TriageTime = %d, Married = %d, MarriedTo = '%s', Flag = '%s', ReferredBy = '%s', RefTokens = %d, RefTokensOffline = %d, Helper = %d, GangMod = %d, LiveBanned = %d WHERE ID = %d",
			PlayerInfo[extraid][pSmslog], PlayerInfo[extraid][pTriageTime], PlayerInfo[extraid][pMarried], szMarriedTo, szFlag, szReferredBy, PlayerInfo[extraid][pRefTokens], PlayerInfo[extraid][pRefTokensOffline], PlayerInfo[extraid][pHelper],
			PlayerInfo[extraid][pGangMod], PlayerInfo[extraid][pLiveBanned], PlayerInfo[extraid][pID]);
			
			mysql_query(szQuery, THREAD_SAVING_FINISHED, extraid, g_MySQLConnections[0]);
		}
		case THREAD_SAVING_FINISHED: {
		    if(GetPVarInt(extraid, "attemptLoginAfter") == 1) { // Log the player back in if we need to (new registrations) and avoid saving things we know don't exist yet (i.e. toys)
                ResetPlayerVariables(extraid);
				AttemptPlayerLogin(extraid, PlayerInfo[extraid][pKey]);
            	DeletePVar(extraid, "attemptLoginAfter");
			} else {

				// Save player toys
				for(new v = 0; v < MAX_PLAYERTOYS; v++) {
				    if(PlayerToyInfo[extraid][v][ptRealID] >= 1) { // Check to ensure the toy has a real ID, in MySQL (if inserted it'll have a "real ID").
				        format(szQuery, sizeof(szQuery), "UPDATE toys SET ModelID = %d, Bone = %d, PosX = '%f', PosY = '%f', PosZ = '%f', RotX = '%f', RotY = '%f', RotZ = '%f', ScaX = '%f', ScaY = '%f', ScaZ = '%f' WHERE Owner = %d AND ID = %d",
						PlayerToyInfo[extraid][v][ptModelID], PlayerToyInfo[extraid][v][ptBone], PlayerToyInfo[extraid][v][ptPosX], PlayerToyInfo[extraid][v][ptPosY], PlayerToyInfo[extraid][v][ptPosZ], PlayerToyInfo[extraid][v][ptRotX], PlayerToyInfo[extraid][v][ptRotY], PlayerToyInfo[extraid][v][ptRotZ],
						PlayerToyInfo[extraid][v][ptScaleX], PlayerToyInfo[extraid][v][ptScaleY], PlayerToyInfo[extraid][v][ptScaleZ], PlayerInfo[extraid][pID], PlayerToyInfo[extraid][v][ptRealID]);

						mysql_query(szQuery, THREAD_NO_RESULT, 0, g_MySQLConnections[0]);
				    }
		   		}
		   		
		   		// Save player vehicles
				for(new v = 0; v < MAX_PLAYERVEHICLES; v++) {
				    if(PlayerVehicleInfo[extraid][v][pvRealID] >= 1) { // Check to ensure the vehicle has a real ID, in MySQL (if inserted, it'll have a "real ID").
				        format(szQuery, sizeof(szQuery), "UPDATE playervehicles SET PosX = '%f', PosY = '%f', PosZ = '%f', PosAngle = '%f', ModelID = %d, LockType = %d, Locked = %d, PaintJob = %d, Color1 = %d, Color2 = %d, \
						Price = %d, Ticket = %d, Weapon0 = %d, Weapon1 = %d, Weapon2 = %d, WepUpgrade = %d, Impound = %d, Spawned = %d, Disabled = %d, NumPlate = '%s', Mod0 = %d, Mod1 = %d, Mod2 = %d,",
						PlayerVehicleInfo[extraid][v][pvPosX], PlayerVehicleInfo[extraid][v][pvPosY], PlayerVehicleInfo[extraid][v][pvPosZ], PlayerVehicleInfo[extraid][v][pvPosAngle], PlayerVehicleInfo[extraid][v][pvModelId], PlayerVehicleInfo[extraid][v][pvLock], PlayerVehicleInfo[extraid][v][pvLocked], PlayerVehicleInfo[extraid][v][pvPaintJob],
						PlayerVehicleInfo[extraid][v][pvColor1], PlayerVehicleInfo[extraid][v][pvColor2], PlayerVehicleInfo[extraid][v][pvPrice], PlayerVehicleInfo[extraid][v][pvTicket], PlayerVehicleInfo[extraid][v][pvWeapons][0], PlayerVehicleInfo[extraid][v][pvWeapons][1], PlayerVehicleInfo[extraid][v][pvWeapons][2],
						PlayerVehicleInfo[extraid][v][pvWepUpgrade], PlayerVehicleInfo[extraid][v][pvImpounded], PlayerVehicleInfo[extraid][v][pvSpawned], PlayerVehicleInfo[extraid][v][pvDisabled], PlayerVehicleInfo[extraid][v][pvNumberPlate], PlayerVehicleInfo[extraid][v][pvMods][0], PlayerVehicleInfo[extraid][v][pvMods][1], PlayerVehicleInfo[extraid][v][pvMods][2]);

						// Concencating the string seems like the most appropriate method for this type... Don't wanna send more than 1 query per player vehicle.
						format(szQuery, sizeof(szQuery), "%s Mod3 = %d, Mod4 = %d, Mod5 = %d, Mod6 = %d, Mod7 = %d, Mod8 = %d, Mod9 = %d, Mod10 = %d, Mod11 = %d, Mod12 = %d, Mod13 = %d, Mod14 = %d WHERE Owner = %d AND ID = %d", szQuery, PlayerVehicleInfo[extraid][v][pvMods][3], PlayerVehicleInfo[extraid][v][pvMods][4], PlayerVehicleInfo[extraid][v][pvMods][5],
						PlayerVehicleInfo[extraid][v][pvMods][6], PlayerVehicleInfo[extraid][v][pvMods][7], PlayerVehicleInfo[extraid][v][pvMods][8], PlayerVehicleInfo[extraid][v][pvMods][9], PlayerVehicleInfo[extraid][v][pvMods][10], PlayerVehicleInfo[extraid][v][pvMods][11], PlayerVehicleInfo[extraid][v][pvMods][12],
						PlayerVehicleInfo[extraid][v][pvMods][13], PlayerVehicleInfo[extraid][v][pvMods][14], PlayerInfo[extraid][pID], PlayerVehicleInfo[extraid][v][pvRealID]);
						
						// Submit the huge query...
						mysql_query(szQuery, THREAD_NO_RESULT, 0, g_MySQLConnections[0]);
				    }
		   		}
            }
		}
	    case THREAD_REGISTER_ACCOUNT: {
			ResetPlayerVariables(extraid);
			
			gPlayerLogged[extraid] = 1;
			PlayerInfo[extraid][pID] = mysql_insert_id(g_MySQLConnections[0]);
			PlayerInfo[extraid][pReg] = 1;
			GetPVarString(extraid, "password", PlayerInfo[extraid][pKey], 128);
			DeletePVar(extraid, "password");
			
			SetPVarInt(extraid, "attemptLoginAfter", 1);
			SaveAccount(extraid);
			
			TotalRegister++;
		}
		case THREAD_LOGIN_ATTEMPT: {
		    mysql_store_result(g_MySQLConnections[0]);
		    
			if(IsPlayerConnected(extraid)) {
			    new
			        szReturn[128],
				    string[128];

		        if(mysql_num_rows(g_MySQLConnections[0]) == 0) { // No rows exist with the specified criteria, so, wrong password!
		            mysql_free_result(g_MySQLConnections[0]);
					ShowMainMenuDialog(extraid, 3);

					gPlayerLogTries[extraid]++;
		        } else {
		            mysql_retrieve_row();

					// Decided against using sscanf as I'd have to create a variable the size of mars. Old school method it is...
					mysql_fetch_field_row(szReturn, "ID", g_MySQLConnections[0]);
					PlayerInfo[extraid][pID] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pKey], "Password", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "Level", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLevel] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "AdminLevel", g_MySQLConnections[0]);
					PlayerInfo[extraid][pAdmin] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pAdminName], "AdminName", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "BanAppealer", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBanAppealer] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Donator", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDonator] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Banned", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBanned] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Permabanned", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPermaBanned] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Disabled", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDisabled] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pIP], "LastIP", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "Registered", g_MySQLConnections[0]);
					PlayerInfo[extraid][pReg] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Tutorial", g_MySQLConnections[0]);
					PlayerInfo[extraid][pTut] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Sex", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSex] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Age", g_MySQLConnections[0]);
					PlayerInfo[extraid][pAge] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Skin", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSkin] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "PosX", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPos_x] = floatstr(szReturn);
					SetPVarFloat(extraid, "realX", floatstr(szReturn));

					mysql_fetch_field_row(szReturn, "PosY", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPos_y] = floatstr(szReturn);
					SetPVarFloat(extraid, "realY", floatstr(szReturn));

					mysql_fetch_field_row(szReturn, "PosZ", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPos_z] = floatstr(szReturn);
					SetPVarFloat(extraid, "realZ", floatstr(szReturn));

					mysql_fetch_field_row(szReturn, "PosR", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPos_r] = floatstr(szReturn);

					mysql_fetch_field_row(szReturn, "ConnectTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pConnectTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Respect", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRespect] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "PhoneNumber", g_MySQLConnections[0]);
					PlayerInfo[extraid][pNumber] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Warnings", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWarns] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gang", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGang] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Faction", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFaction] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Leader", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLeader] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Rank", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRank] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Job", g_MySQLConnections[0]);
					PlayerInfo[extraid][pJob] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Job2", g_MySQLConnections[0]);
					PlayerInfo[extraid][pJob2] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "UpgradePoints", g_MySQLConnections[0]);
					PlayerInfo[extraid][gPupgrade] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "SpawnArmor", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSarmor] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Cash", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCash] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Bank", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBank] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Insurance", g_MySQLConnections[0]);
					PlayerInfo[extraid][pInsurance] = strval(szReturn);
					
					mysql_fetch_field_row(szReturn, "Smslog", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSmslog] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Crimes", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCrimes] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Arrested", g_MySQLConnections[0]);
					PlayerInfo[extraid][pArrested] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "WantedLevel", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWantedLevel] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Health", g_MySQLConnections[0]);
					PlayerInfo[extraid][pHealth] = floatstr(szReturn);

					mysql_fetch_field_row(szReturn, "Armor", g_MySQLConnections[0]);
					PlayerInfo[extraid][pArmor] = floatstr(szReturn);

					mysql_fetch_field_row(szReturn, "Pot", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPot] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Crack", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCrack] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Radio", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRadio] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "RadioFreq", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRadioFreq] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Phonebook", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPhoneBook] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Dice", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDice] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "CDPlayer", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCDPlayer] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Materials", g_MySQLConnections[0]);
					PlayerInfo[extraid][pMats] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Rope", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRope] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Cigars", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCigar] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Sprunk", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSprunk] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Spraycan", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSpraycan] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "House", g_MySQLConnections[0]);
					PlayerInfo[extraid][pHouse] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "House2", g_MySQLConnections[0]);
					PlayerInfo[extraid][pHouse2] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Renting", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRenting] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Interior", g_MySQLConnections[0]);
					PlayerInfo[extraid][pInt] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "VirtualWorld", g_MySQLConnections[0]);
					PlayerInfo[extraid][pVW] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Jailed", g_MySQLConnections[0]);
					PlayerInfo[extraid][pJailed] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "JailTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pJailTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun0", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][0] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun1", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][1] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun2", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][2] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun3", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][3] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun4", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][4] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun5", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][5] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun6", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][6] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun7", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][7] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun8", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][8] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun9", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][9] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun10", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][10] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Gun11", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGuns][11] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Paycheck", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPayCheck] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "PayReady", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPayReady] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Hospital", g_MySQLConnections[0]);
					PlayerInfo[extraid][pHospital] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "DetSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDetSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "LawSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLawSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "SexSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSexSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "DrugsSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDrugsSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "SmugglerSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSmugSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "ArmsSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pArmsSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "MechSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pMechSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "FishSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFishSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "BoxSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBoxSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "TruckSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pTruckSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "CarSkill", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCarSkill] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "LawyerTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLawyerTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "LawyerFreeTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLawyerFreeTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "DrugsTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDrugsTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "MechTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pMechTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "SexTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSexTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "CarTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCarTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Fishes", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFishes] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "BiggestFish", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBiggestFish] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "pWEXists", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedObject] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "pWX", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedPos][0] = floatstr(szReturn);

					mysql_fetch_field_row(szReturn, "pWY", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedPos][1] = floatstr(szReturn);

					mysql_fetch_field_row(szReturn, "pWZ", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedPos][2] = floatstr(szReturn);

					mysql_fetch_field_row(szReturn, "pWVW", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedVW] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "pWInt", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedInt] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "pWValue", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWeedGrowth] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "pWSeeds", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWSeeds] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Wins", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWins] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Loses", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLoses] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "FightingStyle", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFightStyle] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Screwdriver", g_MySQLConnections[0]);
					PlayerInfo[extraid][pScrewdriver] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Wristwatch", g_MySQLConnections[0]);
					PlayerInfo[extraid][pWristwatch] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Tire", g_MySQLConnections[0]);
					PlayerInfo[extraid][pTire] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Firstaid", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFirstaid] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Rccam", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRccam] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Receiver", g_MySQLConnections[0]);
					PlayerInfo[extraid][pReceiver] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "GPS", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGPS] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Sweep", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSweep] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "SweepLeft", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSweepLeft] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Bugged", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBugged] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "CarLic", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCarLic] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "FlyLic", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFlyLic] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "BoatLic", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBoatLic] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "FishLic", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFishLic] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "GunLic", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGunLic] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Division", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDivision] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "TicketTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pTicketTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "HeadValue", g_MySQLConnections[0]);
					PlayerInfo[extraid][pHeadValue] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pContractBy], "ContractBy", g_MySQLConnections[0]);

		            mysql_fetch_field_row(PlayerInfo[extraid][pContractDetail], "ContractBy", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "Bombs", g_MySQLConnections[0]);
					PlayerInfo[extraid][pBombs] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "CHits", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCHits] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "FHits", g_MySQLConnections[0]);
					PlayerInfo[extraid][pFHits] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pPrisonedBy], "PrisonedBy", g_MySQLConnections[0]);

					mysql_fetch_field_row(PlayerInfo[extraid][pPrisonReason], "PrisonReason", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "AcceptReport", g_MySQLConnections[0]);
					PlayerInfo[extraid][pAcceptReport] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "TrashReport", g_MySQLConnections[0]);
					PlayerInfo[extraid][pTrashReport] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Accent", g_MySQLConnections[0]);
					PlayerInfo[extraid][pAccent] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "NewMuted", g_MySQLConnections[0]);
					PlayerInfo[extraid][pNMute] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "NewMutedTotal", g_MySQLConnections[0]);
					PlayerInfo[extraid][pNMuteTotal] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "AdMuted", g_MySQLConnections[0]);
					PlayerInfo[extraid][pADMute] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "AdMutedTotal", g_MySQLConnections[0]);
					PlayerInfo[extraid][pADMuteTotal] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "ReportMuted", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRMuted] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "ReportMutedTotal", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRMutedTotal] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "ReportMutedTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRMutedTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Speedo", g_MySQLConnections[0]);
					PlayerInfo[extraid][pSpeedo] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "GCMuted", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGCMuted] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "GCMutedTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGCMutedTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "CallsAccepted", g_MySQLConnections[0]);
					PlayerInfo[extraid][pCallsAccepted] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "PatientsDelivered", g_MySQLConnections[0]);
					PlayerInfo[extraid][pPatientsDelivered] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "TriageTime", g_MySQLConnections[0]);
					PlayerInfo[extraid][pTriageTime] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Married", g_MySQLConnections[0]);
					PlayerInfo[extraid][pMarried] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pMarriedTo], "MarriedTo", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "OnDuty", g_MySQLConnections[0]);
					PlayerInfo[extraid][pDuty] = strval(szReturn);

					mysql_fetch_field_row(PlayerInfo[extraid][pFlag], "Flag", g_MySQLConnections[0]);

					mysql_fetch_field_row(PlayerInfo[extraid][pReferredBy], "ReferredBy", g_MySQLConnections[0]);

					mysql_fetch_field_row(szReturn, "ReferredBy", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRefTokens] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "RefTokens", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRefTokens] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "RefTokensOffline", g_MySQLConnections[0]);
					PlayerInfo[extraid][pRefTokensOffline] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "Helper", g_MySQLConnections[0]);
					PlayerInfo[extraid][pHelper] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "GangMod", g_MySQLConnections[0]);
					PlayerInfo[extraid][pGangMod] = strval(szReturn);

					mysql_fetch_field_row(szReturn, "LiveBanned", g_MySQLConnections[0]);
					PlayerInfo[extraid][pLiveBanned] = strval(szReturn);

					// Free the result (of the entire player record) when we're done with loading it...
					mysql_free_result(g_MySQLConnections[0]);

					if(PlayerInfo[extraid][pHospital] == 1) {
					    PlayerInfo[extraid][pHospital] = 0;
					    SetPVarInt(extraid, "MedicBill", 1);
					}

					TotalLogin++;
					GetPlayerIp(extraid, PlayerInfo[extraid][pIP], 16);
					if(PlayerInfo[extraid][pBanned] >= 1 || PlayerInfo[extraid][pPermaBanned] >= 1) {
						format(string, sizeof(string), "WARNING: %s (IP:%s) tried to login whilst banned and has been auto-banned.", GetPlayerNameEx(extraid), PlayerInfo[extraid][pIP]);
						ABroadCast(COLOR_YELLOW, string, 1);
						SendClientMessage(extraid, COLOR_NEWS, "You're banned from Stratum Roleplay.");
						AddBan(PlayerInfo[extraid][pIP]);
						Log("logs/ban.log", string);
						return Kick(extraid);
					}
					
					if(PlayerInfo[extraid][pSprunk] > 10) {
					    format(string, sizeof(string), "You're carrying too much Sprunk. You now have 10 cans, and have been refunded $%d for your loss.", PlayerInfo[extraid][pSprunk] - 10);
						SendClientMessage(extraid, COLOR_GREY, string);
						
						PlayerInfo[extraid][pCash] += PlayerInfo[extraid][pSprunk] - 10;
						PlayerInfo[extraid][pSprunk] = 10;
					}
					
					if(PlayerInfo[extraid][pSmslog] >= 1) {
					    format(string, sizeof(string), "SMS logs have been removed, you have been refunded %d materials.", PlayerInfo[extraid][pSmslog] * 2000);
						SendClientMessage(extraid, COLOR_GREY, string);

                        PlayerInfo[extraid][pMats] += PlayerInfo[extraid][pSmslog] * 2000;
						PlayerInfo[extraid][pSmslog] = 0;
					}

			        if(PlayerInfo[extraid][pTut] == 1)
						PlayerPlaySound(extraid,SOUND_OFF,2050.1995, 1344.5500, 13.2378); //Music Off
						
					SetSpawnInfo(extraid, 0, PlayerInfo[extraid][pSkin], PlayerInfo[extraid][pPos_x], PlayerInfo[extraid][pPos_y], PlayerInfo[extraid][pPos_z], 1.0, -1, -1, -1, -1, -1, -1);

					gPlayerLogged[extraid] = 1;
					SpawnPlayer(extraid);
					SetPlayerScore(extraid, PlayerInfo[extraid][pLevel]);

					if(PlayerInfo[extraid][pTut] == 1) {
						HideMainMenuGUI(extraid);
						InsideTut[extraid] = 0;
					}

					if(PlayerInfo[extraid][pDisabled] != 0) {
						format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s has been auto kicked because their account is disabled.", GetPlayerNameEx(extraid));
				        ABroadCast(COLOR_YELLOW, string, 4);
					    SendClientMessage(extraid, COLOR_NEWS, "This account is disabled. Please contact us via the forum ("WEBSITE").");
					    return Kick(extraid);
					}

					if(PlayerInfo[extraid][pAdmin] < 0 || PlayerInfo[extraid][pAdmin] > 6) {
			   			new name[MAX_PLAYER_NAME];
						GetPlayerName(extraid, name, sizeof(name));
						format(string, sizeof(string), "{AA3333}AdmWarning{FFFF00}: %s attempted to log in with Admin Level %d.", GetPlayerNameEx(extraid), PlayerInfo[extraid][pAdmin]);
						PlayerInfo[extraid][pAdmin] = 0;
				        ABroadCast(COLOR_YELLOW, string, 4);
						return Kick(extraid);
				    }

					if(PlayerInfo[extraid][pInt] > 0 || PlayerInfo[extraid][pVW] > 0) {
					    LoadObjectsForPlayer(extraid);
				    }

					SkinDelay(extraid);
					SetPlayerFightingStyle(extraid, PlayerInfo[extraid][pFightStyle]);
					SetPlayerToTeamColor(extraid);

					if(AdminLoggedInBefore[extraid] == 0) {
						if(PlayerInfo[extraid][pTut] == 1) {
							format(string, sizeof(string), "Welcome to Stratum Roleplay, %s.", GetPlayerNameEx(extraid));
							SendClientMessage(extraid, COLOR_NEWS, string);
						}

						if(PlayerInfo[extraid][pAdmin] > 0 && PlayerInfo[extraid][pTut] == 1) {
							format(string, sizeof(string), "You have logged in as Level %d Admin.",PlayerInfo[extraid][pAdmin]);
							SendClientMessage(extraid, COLOR_WHITE,string);

							if(strlen(PlayerInfo[extraid][pAdminName]) > 2 && strlen(PlayerInfo[extraid][pAdminName]) < 20) {
								format(string, sizeof(string), "%s (%s) has logged in as Level %d Admin.", GetPlayerNameEx(extraid), PlayerInfo[extraid][pAdminName], PlayerInfo[extraid][pAdmin]);
							}
							else {
								format(string, sizeof(string), "%s (unset admin name) has logged in as Level %d Admin.", GetPlayerNameEx(extraid), PlayerInfo[extraid][pAdmin]);
							}

							foreach(Player, i) {
								if(PlayerInfo[i][pAdmin] >= 5 && PlayerInfo[i][pAdmin] >= PlayerInfo[extraid][pAdmin] && i != extraid) {
									SendClientMessage(i, COLOR_WHITE, string);
								}
							}
						}
						if(PlayerInfo[extraid][pTut] == 1) {
							format(string, sizeof(string), "~w~Welcome~n~~y~%s", GetPlayerNameEx(extraid));
							GameTextForPlayer(extraid, string, 5000, 1);

							new motdstring[128];
							format(motdstring, sizeof(motdstring), "News: %s", GlobalMOTD);
							SendClientMessage(extraid, COLOR_WHITE, motdstring);

							new amotdstring[128];
							format(amotdstring, sizeof(amotdstring), "Admin News: %s", AdminMOTD);
							if(PlayerInfo[extraid][pAdmin] > 0)  SendClientMessage(extraid, COLOR_YELLOW, amotdstring);
						}
						if(PlayerInfo[extraid][pGang] < 255 && PlayerInfo[extraid][pTut] == 1) {
							format(string, sizeof(string), "Family MOTD: %s.", FamilyInfo[PlayerInfo[extraid][pGang]][FamilyMOTD]);
							SendClientMessage(extraid, COLOR_YELLOW, string);
						}
						if(!isnull(PlayerInfo[extraid][pFlag])) {
							format(string, sizeof(string), "%s has an outstanding flag.", GetPlayerNameEx(extraid));
							ABroadCast(COLOR_WHITE, string, 1);
				  		}
				  		if(PlayerInfo[extraid][pRefTokensOffline] != 0) {
				  		    format(string, sizeof(string), "You have gained %d referral token(s) while you were offline. Use /refshop to spend them.", PlayerInfo[extraid][pRefTokensOffline]);
				  		    SendClientMessage(extraid, COLOR_YELLOW, string);
				  		    PlayerInfo[extraid][pRefTokens] += PlayerInfo[extraid][pRefTokensOffline];
				  		    PlayerInfo[extraid][pRefTokensOffline] = 0;
				  		}
			   			if(PlayerInfo[extraid][pJob2] >= 1 && PlayerInfo[extraid][pDonator] < 2 && PlayerInfo[extraid][pLevel] < 25) {
							PlayerInfo[extraid][pJob2] = 0;
							SendClientMessage(extraid, COLOR_YELLOW, "You have lost your secondary job due to the fact that you no longer have a donator package or are below level 25.");
						}
					}
					
					/* --------- Load alternative player items (vehicles, toys, etc) --------- */
					LoadPlayerDynamicItems(extraid);
					format(szQuery, sizeof(szQuery), "UPDATE connections SET AccountID = %d WHERE PlayerID = %d", PlayerInfo[extraid][pID], extraid);
					mysql_query(szQuery, THREAD_NO_RESULT, extraid, g_MySQLConnections[0]);
					
					if(PlayerInfo[extraid][pWeedObject] != 0) {
						PlayerInfo[extraid][pWeedObject] = CreateDynamicObject(3409, PlayerInfo[extraid][pWeedPos][0], PlayerInfo[extraid][pWeedPos][1], PlayerInfo[extraid][pWeedPos][2], 0.0, 0.0, 0.0, PlayerInfo[extraid][pWeedVW], PlayerInfo[extraid][pWeedInt]);
					}

			 		new
						iCheckOne = INVALID_HOUSE_ID,
						iCheckTwo = INVALID_HOUSE_ID,
						szPlayerName[MAX_PLAYER_NAME];

					GetPlayerName(extraid, szPlayerName, sizeof(szPlayerName));

					for(new i = 0; i < MAX_HOUSES; ++i) if(strcmp(szPlayerName, HouseInfo[i][hOwner], false) == 0) {
						if(iCheckOne != INVALID_HOUSE_ID) iCheckTwo = i;
						else if(iCheckTwo == INVALID_HOUSE_ID) iCheckOne = i;
						else break;
					}

					if(iCheckOne != INVALID_HOUSE_ID)
						PlayerInfo[extraid][pHouse] = iCheckOne;
					else PlayerInfo[extraid][pHouse] = INVALID_HOUSE_ID;

					if(iCheckTwo != INVALID_HOUSE_ID)
						PlayerInfo[extraid][pHouse2] = iCheckTwo;
					else PlayerInfo[extraid][pHouse2] = INVALID_HOUSE_ID;

					if(PlayerInfo[extraid][pRenting] != INVALID_HOUSE_ID && (PlayerInfo[extraid][pHouse] != INVALID_HOUSE_ID || PlayerInfo[extraid][pHouse2] != INVALID_HOUSE_ID)) {
						PlayerInfo[extraid][pRenting] = INVALID_HOUSE_ID;
					}
				}
			} else mysql_free_result(g_MySQLConnections[0]); // The player logged off before we could get their result, so we need to free it.
		}
	}
	return 1;
}
Reply


Messages In This Thread
A weird mysql (crashdetect) crash detection. So annoying af - by Noris - 16.05.2016, 05:17
Re: A weird mysql (crashdetect) crash detection. So annoying af - by Noris - 16.05.2016, 05:22

Forum Jump:


Users browsing this thread: 1 Guest(s)