View Single Post
Old 17/01/2014, 07:36 PM   #2
nguyenquynh
Banned
 
Join Date: Sep 2012
Posts: 94
Reputation: 0
Default Re: Error in my script?

OnquerryFinish:
Code:
// Callbacks
forward OnQueryFinish(resultid, extraid, handleid);
public OnQueryFinish(resultid, extraid, handleid)
{
    new rows, fields;
	if(resultid != SENDDATA_THREAD) {
		if(extraid != INVALID_PLAYER_ID) {
			if(g_arrQueryHandle{extraid} != -1 && g_arrQueryHandle{extraid} != handleid) return 0;
		}
		cache_get_data(rows, fields, MainPipeline);
	}
	switch(resultid)
	{
		case LOADMOTDDATA_THREAD:
		{
   			for(new i;i < rows;i++)
			{
			    new szResult[32];
   				cache_get_field_content(i, "gMOTD", GlobalMOTD, MainPipeline);
				cache_get_field_content(i, "aMOTD", AdminMOTD, MainPipeline);
				cache_get_field_content(i, "vMOTD", VIPMOTD, MainPipeline);
				cache_get_field_content(i, "cMOTD", CAMOTD, MainPipeline);
				cache_get_field_content(i, "pMOTD", pMOTD, MainPipeline);
				cache_get_field_content(i, "ShopTechPay", szResult, MainPipeline); ShopTechPay = floatstr(szResult);
				break;
			}
		}
		case LOADUSERDATA_THREAD:
		{
			if(IsPlayerConnected(extraid))
			{
   				new szField[MAX_PLAYER_NAME], szResult[64];

				for(new row;row < rows;row++)
				{
					cache_get_field_content(row, "Username", szField, MainPipeline);

					if(strcmp(szField, GetPlayerNameExt(extraid), true) != 0)
					{
						return 1;
					}
					cache_get_field_content(row, "id", szResult, MainPipeline); PlayerInfo[extraid][pId] = strval(szResult);
					cache_get_field_content(row, "Online", szResult, MainPipeline); PlayerInfo[extraid][pOnline] = strval(szResult);
					cache_get_field_content(row, "IP", PlayerInfo[extraid][pIP]);
					cache_get_field_content(row, "SecureIP", PlayerInfo[extraid][pSecureIP]);
					cache_get_field_content(row,  "ConnectedTime", szResult, MainPipeline); PlayerInfo[extraid][pConnectHours] = strval(szResult);
					cache_get_field_content(row,  "Age", szResult, MainPipeline); PlayerInfo[extraid][pAge] = strval(szResult);
					cache_get_field_content(row,  "Checkmapin", szResult, MainPipeline); PlayerInfo[extraid][pCheckmapin] = strval(szResult);
					cache_get_field_content(row,  "DJ", szResult, MainPipeline); PlayerInfo[extraid][pDJ] = strval(szResult);
					cache_get_field_content(row,  "Sex", szResult, MainPipeline); PlayerInfo[extraid][pSex] = strval(szResult);
					cache_get_field_content(row,  "Band", szResult, MainPipeline); PlayerInfo[extraid][pBanned] = strval(szResult);
					cache_get_field_content(row,  "PermBand", szResult, MainPipeline); PlayerInfo[extraid][pPermaBanned] = strval(szResult);
					cache_get_field_content(row,  "Registered", szResult, MainPipeline); PlayerInfo[extraid][pReg] = strval(szResult);
					cache_get_field_content(row,  "Warnings", szResult, MainPipeline); PlayerInfo[extraid][pWarns] = strval(szResult);
					cache_get_field_content(row,  "Disabled", szResult, MainPipeline); PlayerInfo[extraid][pDisabled] = strval(szResult);
					cache_get_field_content(row,  "Level", szResult, MainPipeline); PlayerInfo[extraid][pLevel] = strval(szResult);
					cache_get_field_content(row,  "AdminLevel", szResult, MainPipeline); PlayerInfo[extraid][pAdmin] = strval(szResult);
					cache_get_field_content(row,  "DonateRank", szResult, MainPipeline); PlayerInfo[extraid][pDonateRank] = strval(szResult);
					cache_get_field_content(row,  "Respect", szResult, MainPipeline); PlayerInfo[extraid][pExp] = strval(szResult);
					cache_get_field_content(row,  "Money", szResult, MainPipeline); PlayerInfo[extraid][pCash] = strval(szResult);
					cache_get_field_content(row,  "Bank", szResult, MainPipeline); PlayerInfo[extraid][pAccount] = strval(szResult);
					cache_get_field_content(row,  "pHealth", szResult, MainPipeline); PlayerInfo[extraid][pHealth] = floatstr(szResult);
					cache_get_field_content(row,  "pArmor", szResult, MainPipeline); PlayerInfo[extraid][pArmor] = floatstr(szResult);
					cache_get_field_content(row,  "pSHealth", szResult, MainPipeline); PlayerInfo[extraid][pSHealth] = floatstr(szResult);
					cache_get_field_content(row,  "Int", szResult, MainPipeline); PlayerInfo[extraid][pInt] = strval(szResult);
					cache_get_field_content(row,  "VirtualWorld", szResult, MainPipeline); PlayerInfo[extraid][pVW] = strval(szResult);
					cache_get_field_content(row,  "Model", szResult, MainPipeline); PlayerInfo[extraid][pModel] = strval(szResult);
					cache_get_field_content(row,  "Clothes", szResult, MainPipeline); PlayerInfo[extraid][pClothes] = strval(szResult);
					cache_get_field_content(row,  "SPos_x", szResult, MainPipeline); PlayerInfo[extraid][pPos_x] = floatstr(szResult);
					cache_get_field_content(row,  "SPos_y", szResult, MainPipeline); PlayerInfo[extraid][pPos_y] = floatstr(szResult);
					cache_get_field_content(row,  "SPos_z", szResult, MainPipeline); PlayerInfo[extraid][pPos_z] = floatstr(szResult);
					cache_get_field_content(row,  "SPos_r", szResult, MainPipeline); PlayerInfo[extraid][pPos_r] = floatstr(szResult);
					cache_get_field_content(row,  "BanAppealer", szResult, MainPipeline); PlayerInfo[extraid][pBanAppealer] = strval(szResult);
					cache_get_field_content(row,  "PR", szResult, MainPipeline); PlayerInfo[extraid][pPR] = strval(szResult);
					cache_get_field_content(row,  "ShopTech", szResult, MainPipeline); PlayerInfo[extraid][pShopTech] = strval(szResult);
					cache_get_field_content(row,  "Undercover", szResult, MainPipeline); PlayerInfo[extraid][pUndercover] = strval(szResult);
					cache_get_field_content(row,  "TogReports", szResult, MainPipeline); PlayerInfo[extraid][pTogReports] = strval(szResult);
					cache_get_field_content(row,  "Radio", szResult, MainPipeline); PlayerInfo[extraid][pRadio] = strval(szResult);
					cache_get_field_content(row,  "RadioFreq", szResult, MainPipeline); PlayerInfo[extraid][pRadioFreq] = strval(szResult);
					cache_get_field_content(row,  "UpgradePoints", szResult, MainPipeline); PlayerInfo[extraid][gPupgrade] = strval(szResult);
					cache_get_field_content(row,  "Origin", szResult, MainPipeline); PlayerInfo[extraid][pOrigin] = strval(szResult);
					cache_get_field_content(row,  "Muted", szResult, MainPipeline); PlayerInfo[extraid][pMuted] = strval(szResult);
					cache_get_field_content(row,  "Crimes", szResult, MainPipeline); PlayerInfo[extraid][pCrimes] = strval(szResult);
					cache_get_field_content(row,  "Accent", szResult, MainPipeline); PlayerInfo[extraid][pAccent] = strval(szResult);
					cache_get_field_content(row,  "CHits", szResult, MainPipeline); PlayerInfo[extraid][pCHits] = strval(szResult);
					cache_get_field_content(row,  "FHits", szResult, MainPipeline); PlayerInfo[extraid][pFHits] = strval(szResult);
					cache_get_field_content(row,  "Arrested", szResult, MainPipeline); PlayerInfo[extraid][pArrested] = strval(szResult);
					cache_get_field_content(row,  "Phonebook", szResult, MainPipeline); PlayerInfo[extraid][pPhoneBook] = strval(szResult);
					cache_get_field_content(row,  "Coin", szResult, MainPipeline); PlayerInfo[extraid][pCoin] = strval(szResult);
					cache_get_field_content(row,  "Vang", szResult, MainPipeline); PlayerInfo[extraid][pVang] = strval(szResult);
					cache_get_field_content(row,  "CuopVangTime", szResult, MainPipeline); PlayerInfo[extraid][pCuopVangTime] = strval(szResult);
					cache_get_field_content(row,  "SieuThiTime", szResult, MainPipeline); PlayerInfo[extraid][pSieuThiTime] = strval(szResult);
					cache_get_field_content(row,  "Dau", szResult, MainPipeline); PlayerInfo[extraid][pDau] = strval(szResult);
					cache_get_field_content(row,  "Doibung", szResult, MainPipeline); PlayerInfo[extraid][pDoibung] = strval(szResult);
					cache_get_field_content(row,  "Thucan", szResult, MainPipeline); PlayerInfo[extraid][pThucan] = strval(szResult);
					cache_get_field_content(row,  "LottoNr", szResult, MainPipeline); PlayerInfo[extraid][pLottoNr] = strval(szResult);
					cache_get_field_content(row,  "Fishes", szResult, MainPipeline); PlayerInfo[extraid][pFishes] = strval(szResult);
					cache_get_field_content(row,  "BiggestFish", szResult, MainPipeline); PlayerInfo[extraid][pBiggestFish] = strval(szResult);
					cache_get_field_content(row,  "Job", szResult, MainPipeline); PlayerInfo[extraid][pJob] = strval(szResult);
					cache_get_field_content(row,  "Job2", szResult, MainPipeline); PlayerInfo[extraid][pJob2] = strval(szResult);
					cache_get_field_content(row,  "Paycheck", szResult, MainPipeline); PlayerInfo[extraid][pPayCheck] = strval(szResult);
					cache_get_field_content(row,  "HeadValue", szResult, MainPipeline); PlayerInfo[extraid][pHeadValue] = strval(szResult);
					cache_get_field_content(row,  "JailTime", szResult, MainPipeline); PlayerInfo[extraid][pJailTime] = strval(szResult);
					cache_get_field_content(row,  "WRestricted", szResult, MainPipeline); PlayerInfo[extraid][pWRestricted] = strval(szResult);
					cache_get_field_content(row,  "Materials", szResult, MainPipeline); PlayerInfo[extraid][pMats] = strval(szResult);
					cache_get_field_content(row,  "Crates", szResult, MainPipeline); PlayerInfo[extraid][pCrates] = strval(szResult);
					cache_get_field_content(row,  "Pot", szResult, MainPipeline); PlayerInfo[extraid][pPot] = strval(szResult);
					cache_get_field_content(row,  "Crack", szResult, MainPipeline); PlayerInfo[extraid][pCrack] = strval(szResult);
					cache_get_field_content(row,  "Leader", szResult, MainPipeline); PlayerInfo[extraid][pLeader] = strval(szResult);
					cache_get_field_content(row,  "Member", szResult, MainPipeline); PlayerInfo[extraid][pMember] = strval(szResult);
					cache_get_field_content(row,  "Division", szResult, MainPipeline); PlayerInfo[extraid][pDivision] = strval(szResult);
					cache_get_field_content(row,  "Cuahang", szResult, MainPipeline); PlayerInfo[extraid][pBusiness] = strval(szResult);
					cache_get_field_content(row,  "Cuahang2", szResult, MainPipeline); PlayerInfo[extraid][pBusiness2] = strval(szResult);
					cache_get_field_content(row,  "HtOnline", szResult, MainPipeline); PlayerInfo[extraid][pHtOnline] = strval(szResult);
					cache_get_field_content(row,  "BusinessType", szResult, MainPipeline); PlayerInfo[extraid][pBusinessType] = strval(szResult);
					cache_get_field_content(row,  "BusinessEnter", szResult, MainPipeline); PlayerInfo[extraid][pBusinessEnter] = strval(szResult);
					cache_get_field_content(row,  "Nguoigioithieu", szResult, MainPipeline); PlayerInfo[extraid][pNguoigioithieu] = strval(szResult);
					cache_get_field_content(row,  "Gioithieu", szResult, MainPipeline); PlayerInfo[extraid][pGioithieu] = strval(szResult);
					cache_get_field_content(row,  "Nongdantime", szResult, MainPipeline); PlayerInfo[extraid][pNongdanTime] = strval(szResult);
					cache_get_field_content(row,  "Cookies", szResult, MainPipeline); PlayerInfo[extraid][pCookies] = strval(szResult);
					cache_get_field_content(row,  "FMember", szResult, MainPipeline); PlayerInfo[extraid][pFMember] = strval(szResult);
					cache_get_field_content(row,  "Rank", szResult, MainPipeline); PlayerInfo[extraid][pRank] = strval(szResult);
					cache_get_field_content(row,  "DetSkill", szResult, MainPipeline); PlayerInfo[extraid][pDetSkill] = strval(szResult);
					cache_get_field_content(row,  "SexSkill", szResult, MainPipeline); PlayerInfo[extraid][pSexSkill] = strval(szResult);
					cache_get_field_content(row,  "BoxSkill", szResult, MainPipeline); PlayerInfo[extraid][pBoxSkill] = strval(szResult);
					cache_get_field_content(row,  "LawSkill", szResult, MainPipeline); PlayerInfo[extraid][pLawSkill] = strval(szResult);
					cache_get_field_content(row,  "MechSkill", szResult, MainPipeline); PlayerInfo[extraid][pMechSkill] = strval(szResult);
					cache_get_field_content(row,  "TruckSkill", szResult, MainPipeline); PlayerInfo[extraid][pTruckSkill] = strval(szResult);
					cache_get_field_content(row,  "DrugsSkill", szResult, MainPipeline); PlayerInfo[extraid][pDrugsSkill] = strval(szResult);
					cache_get_field_content(row,  "ArmsSkill", szResult, MainPipeline); PlayerInfo[extraid][pArmsSkill] = strval(szResult);
					cache_get_field_content(row,  "SmugglerSkill", szResult, MainPipeline); PlayerInfo[extraid][pSmugSkill] = strval(szResult);
					cache_get_field_content(row,  "FishSkill", szResult, MainPipeline); PlayerInfo[extraid][pFishSkill] = strval(szResult);
					cache_get_field_content(row,  "FightingStyle", szResult, MainPipeline); PlayerInfo[extraid][pFightStyle] = strval(szResult);
					cache_get_field_content(row,  "PhoneNr", szResult, MainPipeline); PlayerInfo[extraid][pPnumber] = strval(szResult);
					cache_get_field_content(row,  "Apartment", szResult, MainPipeline); PlayerInfo[extraid][pPhousekey] = strval(szResult);
					cache_get_field_content(row,  "Apartment2", szResult, MainPipeline); PlayerInfo[extraid][pPhousekey2] = strval(szResult);
					cache_get_field_content(row,  "Renting", szResult, MainPipeline); PlayerInfo[extraid][pRenting] = strval(szResult);
					cache_get_field_content(row,  "CarLic", szResult, MainPipeline); PlayerInfo[extraid][pCarLic] = strval(szResult);
					cache_get_field_content(row,  "FlyLic", szResult, MainPipeline); PlayerInfo[extraid][pFlyLic] = strval(szResult);
					cache_get_field_content(row,  "BoatLic", szResult, MainPipeline); PlayerInfo[extraid][pBoatLic] = strval(szResult);
					cache_get_field_content(row,  "FishLic", szResult, MainPipeline); PlayerInfo[extraid][pFishLic] = strval(szResult);
					cache_get_field_content(row,  "CheckCash", szResult, MainPipeline); PlayerInfo[extraid][pCheckCash] = strval(szResult);
					cache_get_field_content(row,  "Checks", szResult, MainPipeline); PlayerInfo[extraid][pChecks] = strval(szResult);
					cache_get_field_content(row,  "GunLic", szResult, MainPipeline); PlayerInfo[extraid][pGunLic] = strval(szResult);

					for(new i = 0; i < 12; i++)
					{
						format(szField, sizeof(szField), "Gun%d", i);
						cache_get_field_content(row,  szField, szResult, MainPipeline);
						PlayerInfo[extraid][pGuns][i] = strval(szResult);
					}

					cache_get_field_content(row,  "DrugsTime", szResult, MainPipeline); PlayerInfo[extraid][pDrugsTime] = strval(szResult);
					cache_get_field_content(row,  "LawyerTime", szResult, MainPipeline); PlayerInfo[extraid][pLawyerTime] = strval(szResult);
					cache_get_field_content(row,  "LawyerFreeTime", szResult, MainPipeline); PlayerInfo[extraid][pLawyerFreeTime] = strval(szResult);
					cache_get_field_content(row,  "MechTime", szResult, MainPipeline); PlayerInfo[extraid][pMechTime] = strval(szResult);
					cache_get_field_content(row,  "SexTime", szResult, MainPipeline); PlayerInfo[extraid][pSexTime] = strval(szResult);
					cache_get_field_content(row,  "PayDay", szResult, MainPipeline); PlayerInfo[extraid][pConnectSeconds] = strval(szResult);
					cache_get_field_content(row,  "PayDayHad", szResult, MainPipeline); PlayerInfo[extraid][pPayDayHad] = strval(szResult);
					cache_get_field_content(row,  "CDPlayer", szResult, MainPipeline); PlayerInfo[extraid][pCDPlayer] = strval(szResult);
					cache_get_field_content(row,  "Dice", szResult, MainPipeline); PlayerInfo[extraid][pDice] = strval(szResult);
					cache_get_field_content(row,  "Spraycan", szResult, MainPipeline); PlayerInfo[extraid][pSpraycan] = strval(szResult);
					cache_get_field_content(row,  "Rope", szResult, MainPipeline); PlayerInfo[extraid][pRope] = strval(szResult);
					cache_get_field_content(row,  "Cigars", szResult, MainPipeline); PlayerInfo[extraid][pCigar] = strval(szResult);
					cache_get_field_content(row,  "Sprunk", szResult, MainPipeline); PlayerInfo[extraid][pSprunk] = strval(szResult);
					cache_get_field_content(row,  "Bombs", szResult, MainPipeline); PlayerInfo[extraid][pBombs] = strval(szResult);
					cache_get_field_content(row,  "Wins", szResult, MainPipeline); PlayerInfo[extraid][pWins] = strval(szResult);
					cache_get_field_content(row,  "Loses", szResult, MainPipeline); PlayerInfo[extraid][pLoses] = strval(szResult);
					cache_get_field_content(row,  "Tutorial", szResult, MainPipeline); PlayerInfo[extraid][pTut] = strval(szResult);
					cache_get_field_content(row,  "OnDuty", szResult, MainPipeline); PlayerInfo[extraid][pDuty] = strval(szResult);
					cache_get_field_content(row,  "Hospital", szResult, MainPipeline); PlayerInfo[extraid][pHospital] = strval(szResult);
					cache_get_field_content(row,  "Married", szResult, MainPipeline); PlayerInfo[extraid][pMarried] = strval(szResult);
					cache_get_field_content(row, "MarriedTo", PlayerInfo[extraid][pMarriedTo], MainPipeline);
					cache_get_field_content(row, "ContractBy", PlayerInfo[extraid][pContractBy], MainPipeline);
					cache_get_field_content(row, "ContractDetail", PlayerInfo[extraid][pContractDetail], MainPipeline);
					cache_get_field_content(row,  "WantedLevel", szResult, MainPipeline); PlayerInfo[extraid][pWantedLevel] = strval(szResult);
					cache_get_field_content(row,  "Insurance", szResult, MainPipeline); PlayerInfo[extraid][pInsurance] = strval(szResult);
					cache_get_field_content(row,  "NewMuted", szResult, MainPipeline); PlayerInfo[extraid][pNMute] = strval(szResult);
					cache_get_field_content(row,  "NewMutedTotal", szResult, MainPipeline); PlayerInfo[extraid][pNMuteTotal] = strval(szResult);
					cache_get_field_content(row,  "AdMuted", szResult, MainPipeline); PlayerInfo[extraid][pADMute] = strval(szResult);
					cache_get_field_content(row,  "AdMutedTotal", szResult, MainPipeline); PlayerInfo[extraid][pADMuteTotal] = strval(szResult);
					cache_get_field_content(row,  "HelpMute", szResult, MainPipeline); PlayerInfo[extraid][pHelpMute] = strval(szResult);
					cache_get_field_content(row,  "Helper", szResult, MainPipeline); PlayerInfo[extraid][pHelper] = strval(szResult);
					cache_get_field_content(row,  "ReportMuted", szResult, MainPipeline); PlayerInfo[extraid][pRMuted] = strval(szResult);
					cache_get_field_content(row,  "ReportMutedTotal", szResult, MainPipeline); PlayerInfo[extraid][pRMutedTotal] = strval(szResult);
					cache_get_field_content(row,  "ReportMutedTime", szResult, MainPipeline); PlayerInfo[extraid][pRMutedTime] = strval(szResult);
					cache_get_field_content(row,  "DMRMuted", szResult, MainPipeline); PlayerInfo[extraid][pDMRMuted] = strval(szResult);
					cache_get_field_content(row,  "VIPMuted", szResult, MainPipeline); PlayerInfo[extraid][pVMuted] = strval(szResult);
					cache_get_field_content(row,  "VIPMutedTime", szResult, MainPipeline); PlayerInfo[extraid][pVMutedTime] = strval(szResult);
					cache_get_field_content(row,  "GiftTime", szResult, MainPipeline); PlayerInfo[extraid][pGiftTime] = strval(szResult);
					cache_get_field_content(row,  "AdvisorDutyHours", szResult, MainPipeline); PlayerInfo[extraid][pDutyHours] = strval(szResult);
					cache_get_field_content(row,  "AcceptedHelp", szResult, MainPipeline); PlayerInfo[extraid][pAcceptedHelp] = strval(szResult);
					cache_get_field_content(row,  "AcceptReport", szResult, MainPipeline); PlayerInfo[extraid][pAcceptReport] = strval(szResult);
					cache_get_field_content(row,  "ShopTechOrders", szResult, MainPipeline); PlayerInfo[extraid][pShopTechOrders] = strval(szResult);
					cache_get_field_content(row,  "TrashReport", szResult, MainPipeline); PlayerInfo[extraid][pTrashReport] = strval(szResult);
					cache_get_field_content(row,  "FactionModerator", szResult, MainPipeline); PlayerInfo[extraid][pFactionModerator] = strval(szResult);
					cache_get_field_content(row,  "GangModerator", szResult, MainPipeline); PlayerInfo[extraid][pGangModerator] = strval(szResult);
					cache_get_field_content(row,  "GangWarn", szResult, MainPipeline); PlayerInfo[extraid][pGangWarn] = strval(szResult);
					cache_get_field_content(row,  "FactionBanned", szResult, MainPipeline); PlayerInfo[extraid][pFactionBanned] = strval(szResult);
					cache_get_field_content(row,  "CSFBanned", szResult, MainPipeline); PlayerInfo[extraid][pCSFBanned] = strval(szResult);
					cache_get_field_content(row,  "VIPInviteDay", szResult, MainPipeline); PlayerInfo[extraid][pVIPInviteDay] = strval(szResult);
					cache_get_field_content(row,  "TempVIP", szResult, MainPipeline); PlayerInfo[extraid][pTempVIP] = strval(szResult);
					cache_get_field_content(row,  "BuddyInvite", szResult, MainPipeline); PlayerInfo[extraid][pBuddyInvited] = strval(szResult);
					cache_get_field_content(row,  "Tokens", szResult, MainPipeline); PlayerInfo[extraid][pTokens] = strval(szResult);
					cache_get_field_content(row,  "PTokens", szResult, MainPipeline); PlayerInfo[extraid][pPaintTokens] = strval(szResult);
					cache_get_field_content(row,  "TriageTime", szResult, MainPipeline); PlayerInfo[extraid][pTriageTime] = strval(szResult);
					cache_get_field_content(row, "PrisonedBy", PlayerInfo[extraid][pPrisonedBy]);
					cache_get_field_content(row, "PrisonReason", PlayerInfo[extraid][pPrisonReason]);
					cache_get_field_content(row, "Flag", PlayerInfo[extraid][pFlag]);
					cache_get_field_content(row,  "TaxiLicense", szResult, MainPipeline); PlayerInfo[extraid][pTaxiLicense] = strval(szResult);
					cache_get_field_content(row,  "TicketTime", szResult, MainPipeline); PlayerInfo[extraid][pTicketTime] = strval(szResult);
					cache_get_field_content(row,  "Screwdriver", szResult, MainPipeline); PlayerInfo[extraid][pScrewdriver] = strval(szResult);
					cache_get_field_content(row,  "Smslog", szResult, MainPipeline); PlayerInfo[extraid][pSmslog] = strval(szResult);
					cache_get_field_content(row,  "Wristwatch", szResult, MainPipeline); PlayerInfo[extraid][pWristwatch] = strval(szResult);
					cache_get_field_content(row,  "Surveillance", szResult, MainPipeline); PlayerInfo[extraid][pSurveillance] = strval(szResult);
					cache_get_field_content(row,  "Tire", szResult, MainPipeline); PlayerInfo[extraid][pTire] = strval(szResult);
					cache_get_field_content(row,  "Firstaid", szResult, MainPipeline); PlayerInfo[extraid][pFirstaid] = strval(szResult);
					cache_get_field_content(row,  "Rccam", szResult, MainPipeline); PlayerInfo[extraid][pRccam] = strval(szResult);
					cache_get_field_content(row,  "Receiver", szResult, MainPipeline); PlayerInfo[extraid][pReceiver] = strval(szResult);
					cache_get_field_content(row,  "GPS", szResult, MainPipeline); PlayerInfo[extraid][pGPS] = strval(szResult);
					cache_get_field_content(row,  "Sweep", szResult, MainPipeline); PlayerInfo[extraid][pSweep] = strval(szResult);
					cache_get_field_content(row,  "SweepLeft", szResult, MainPipeline); PlayerInfo[extraid][pSweepLeft] = strval(szResult);
					cache_get_field_content(row,  "Bugged", szResult, MainPipeline); PlayerInfo[extraid][pBugged] = strval(szResult);
					cache_get_field_content(row,  "Smslog0", PlayerInfo[extraid][pSmslog0], MainPipeline);
					cache_get_field_content(row,  "Smslog1", PlayerInfo[extraid][pSmslog1], MainPipeline);
					cache_get_field_content(row,  "Smslog2", PlayerInfo[extraid][pSmslog2], MainPipeline);
					cache_get_field_content(row,  "Smslog3", PlayerInfo[extraid][pSmslog3], MainPipeline);
					cache_get_field_content(row,  "Smslog4", PlayerInfo[extraid][pSmslog4], MainPipeline);
					cache_get_field_content(row,  "Smslog5", PlayerInfo[extraid][pSmslog5], MainPipeline);
					cache_get_field_content(row,  "Smslog6", PlayerInfo[extraid][pSmslog6], MainPipeline);
					cache_get_field_content(row,  "Smslog7", PlayerInfo[extraid][pSmslog7], MainPipeline);
					cache_get_field_content(row,  "Smslog8", PlayerInfo[extraid][pSmslog8], MainPipeline);
					cache_get_field_content(row,  "Smslog9", PlayerInfo[extraid][pSmslog9], MainPipeline);
					cache_get_field_content(row,  "KillLog0", PlayerInfo[extraid][pKillLog0], MainPipeline);
					cache_get_field_content(row,  "KillLog1", PlayerInfo[extraid][pKillLog1], MainPipeline);
					cache_get_field_content(row,  "KillLog2", PlayerInfo[extraid][pKillLog2], MainPipeline);
					cache_get_field_content(row,  "KillLog3", PlayerInfo[extraid][pKillLog3], MainPipeline);
					cache_get_field_content(row,  "KillLog4", PlayerInfo[extraid][pKillLog4], MainPipeline);
					cache_get_field_content(row,  "KillLog5", PlayerInfo[extraid][pKillLog5], MainPipeline);
					cache_get_field_content(row,  "KillLog6", PlayerInfo[extraid][pKillLog6], MainPipeline);
					cache_get_field_content(row,  "KillLog7", PlayerInfo[extraid][pKillLog7], MainPipeline);
					cache_get_field_content(row,  "KillLog8", PlayerInfo[extraid][pKillLog8], MainPipeline);
					cache_get_field_content(row,  "KillLog9", PlayerInfo[extraid][pKillLog9], MainPipeline);
					cache_get_field_content(row,  "pWExists", szResult, MainPipeline); PlayerInfo[extraid][pWeedObject] = strval(szResult);
					cache_get_field_content(row,  "pWX", szResult, MainPipeline); PlayerInfo[extraid][pWeedPos][0] = floatstr(szResult);
					cache_get_field_content(row,  "pWY", szResult, MainPipeline); PlayerInfo[extraid][pWeedPos][1] = floatstr(szResult);
					cache_get_field_content(row,  "pWZ", szResult, MainPipeline); PlayerInfo[extraid][pWeedPos][2] = floatstr(szResult);
					cache_get_field_content(row,  "pWVW", szResult, MainPipeline); PlayerInfo[extraid][pWeedVW] = strval(szResult);
					cache_get_field_content(row,  "pWInt", szResult, MainPipeline); PlayerInfo[extraid][pWeedInt] = strval(szResult);
					cache_get_field_content(row,  "pWValue", szResult, MainPipeline); PlayerInfo[extraid][pWeedGrowth] = strval(szResult);
					cache_get_field_content(row,  "pWSeeds", szResult, MainPipeline); PlayerInfo[extraid][pWSeeds] = strval(szResult);
					cache_get_field_content(row,  "Warrants", szResult, MainPipeline); PlayerInfo[extraid][pWarrant] = strval(szResult);
					cache_get_field_content(row,  "JudgeJailTime", szResult, MainPipeline); PlayerInfo[extraid][pJudgeJailTime] = strval(szResult);
					cache_get_field_content(row,  "JudgeJailType", szResult, MainPipeline); PlayerInfo[extraid][pJudgeJailType] = strval(szResult);
					cache_get_field_content(row,  "ProbationTime", szResult, MainPipeline); PlayerInfo[extraid][pProbationTime] = strval(szResult);
					cache_get_field_content(row,  "DMKills", szResult, MainPipeline); PlayerInfo[extraid][pDMKills] = strval(szResult);
					cache_get_field_content(row,  "Order", szResult, MainPipeline); PlayerInfo[extraid][pOrder] = strval(szResult);
					cache_get_field_content(row,  "OrderConfirmed", szResult, MainPipeline); PlayerInfo[extraid][pOrderConfirmed] = strval(szResult);
					cache_get_field_content(row,  "CallsAccepted", szResult, MainPipeline); PlayerInfo[extraid][pCallsAccepted] = strval(szResult);
					cache_get_field_content(row,  "PatientsDelivered", szResult, MainPipeline); PlayerInfo[extraid][pPatientsDelivered] = strval(szResult);
					cache_get_field_content(row,  "LiveBanned", szResult, MainPipeline); PlayerInfo[extraid][pLiveBanned] = strval(szResult);
					cache_get_field_content(row,  "FreezeBank", szResult, MainPipeline); PlayerInfo[extraid][pFreezeBank] = strval(szResult);
					cache_get_field_content(row,  "FreezeHouse", szResult, MainPipeline); PlayerInfo[extraid][pFreezeHouse] = strval(szResult);
					cache_get_field_content(row,  "FreezeCar", szResult, MainPipeline); PlayerInfo[extraid][pFreezeCar] = strval(szResult);
					cache_get_field_content(row,  "Firework", szResult, MainPipeline); PlayerInfo[extraid][pFirework] = strval(szResult);
					cache_get_field_content(row,  "Boombox", szResult, MainPipeline); PlayerInfo[extraid][pBoombox] = strval(szResult);
					cache_get_field_content(row,  "Hydration", szResult, MainPipeline); PlayerInfo[extraid][pHydration] = strval(szResult);
					cache_get_field_content(row,  "Speedo", szResult, MainPipeline); PlayerInfo[extraid][pSpeedo] = strval(szResult);
					cache_get_field_content(row,  "DoubleEXP", szResult, MainPipeline); PlayerInfo[extraid][pDoubleEXP] = strval(szResult);
					cache_get_field_content(row,  "EXPToken", szResult, MainPipeline); PlayerInfo[extraid][pEXPToken] = strval(szResult);
					cache_get_field_content(row,  "RacePlayerLaps", szResult, MainPipeline); PlayerInfo[extraid][pRacePlayerLaps] = strval(szResult);
					cache_get_field_content(row,  "Ringtone", szResult, MainPipeline); PlayerInfo[extraid][pRingtone] = strval(szResult);
					cache_get_field_content(row,  "VIPM", szResult, MainPipeline); PlayerInfo[extraid][pVIPM] = strval(szResult);
					cache_get_field_content(row,  "VIPMO", szResult, MainPipeline); PlayerInfo[extraid][pVIPMO] = strval(szResult);
					cache_get_field_content(row,  "VIPExpire", szResult, MainPipeline); PlayerInfo[extraid][pVIPExpire] = strval(szResult);
					cache_get_field_content(row,  "GVip", szResult, MainPipeline); PlayerInfo[extraid][pGVip] = strval(szResult);
					cache_get_field_content(row,  "SeniorModerator", szResult, MainPipeline); PlayerInfo[extraid][pSMod] = strval(szResult);
					cache_get_field_content(row,  "Watchdog", szResult, MainPipeline); PlayerInfo[extraid][pWatchdog] = strval(szResult);
					cache_get_field_content(row,  "VIPSold", szResult, MainPipeline); PlayerInfo[extraid][pVIPSold] = strval(szResult);
					cache_get_field_content(row,  "GoldBoxTokens", szResult, MainPipeline); PlayerInfo[extraid][pGoldBoxTokens] = strval(szResult);
					cache_get_field_content(row,  "DrawChance", szResult, MainPipeline); PlayerInfo[extraid][pRewardDrawChance] = strval(szResult);
					cache_get_field_content(row,  "RewardHours", szResult, MainPipeline); PlayerInfo[extraid][pRewardHours] = floatstr(szResult);
					cache_get_field_content(row,  "CarsRestricted", szResult, MainPipeline); PlayerInfo[extraid][pRVehRestricted] = strval(szResult);
					cache_get_field_content(row,  "LastCarWarning", szResult, MainPipeline); PlayerInfo[extraid][pLastRVehWarn] = strval(szResult);
					cache_get_field_content(row,  "CarWarns", szResult, MainPipeline); PlayerInfo[extraid][pRVehWarns] = strval(szResult);
					cache_get_field_content(row,  "Flagged", szResult, MainPipeline); PlayerInfo[extraid][pFlagged] = strval(szResult);
					cache_get_field_content(row,  "Paper", szResult, MainPipeline); PlayerInfo[extraid][pPaper] = strval(szResult);
					cache_get_field_content(row,  "MailEnabled", szResult, MainPipeline); PlayerInfo[extraid][pMailEnabled] = strval(szResult);
					cache_get_field_content(row,  "Mailbox", szResult, MainPipeline); PlayerInfo[extraid][pMailbox] = strval(szResult);

					/*cache_get_field_content(row,  "BBackpackStorage", szResult, MainPipeline); StorageInfo[extraid][0][sStorage] = strval(szResult);
					cache_get_field_content(row,  "BBackpackAttached", szResult, MainPipeline); StorageInfo[extraid][0][sAttached] = strval(szResult);
					cache_get_field_content(row,  "BBackpackCash", szResult, MainPipeline); StorageInfo[extraid][0][sCash] = strval(szResult);
					cache_get_field_content(row,  "BBackpackPot", szResult, MainPipeline); StorageInfo[extraid][0][sPot] = strval(szResult);
					cache_get_field_content(row,  "BBackpackCrack", szResult, MainPipeline); StorageInfo[extraid][0][sCrack] = strval(szResult);
					cache_get_field_content(row,  "BBackpackMats", szResult, MainPipeline); StorageInfo[extraid][0][sMats] = strval(szResult);
					cache_get_field_content(row,  "BackpackStorage", szResult, MainPipeline); StorageInfo[extraid][1][sStorage] = strval(szResult);
					cache_get_field_content(row,  "BackpackAttached", szResult, MainPipeline); StorageInfo[extraid][1][sAttached] = strval(szResult);
					cache_get_field_content(row,  "BackpackCash", szResult, MainPipeline); StorageInfo[extraid][1][sCash] = strval(szResult);
					cache_get_field_content(row,  "BackpackPot", szResult, MainPipeline); StorageInfo[extraid][1][sPot] = strval(szResult);
					cache_get_field_content(row,  "BackpackCrack", szResult, MainPipeline); StorageInfo[extraid][1][sCrack] = strval(szResult);
					cache_get_field_content(row,  "BackpackMats", szResult, MainPipeline); StorageInfo[extraid][1][sMats] = strval(szResult);
					cache_get_field_content(row,  "BriefcaseStorage", szResult, MainPipeline); StorageInfo[extraid][2][sStorage] = strval(szResult);
					cache_get_field_content(row,  "BriefcaseAttached", szResult, MainPipeline); StorageInfo[extraid][2][sAttached] = strval(szResult);
					cache_get_field_content(row,  "BriefcaseCash", szResult, MainPipeline); StorageInfo[extraid][2][sCash] = strval(szResult);
					cache_get_field_content(row,  "BriefcasePot", szResult, MainPipeline); StorageInfo[extraid][2][sPot] = strval(szResult);
					cache_get_field_content(row,  "BriefcaseCrack", szResult, MainPipeline); StorageInfo[extraid][2][sCrack] = strval(szResult);
					cache_get_field_content(row,  "BriefcaseMats", szResult, MainPipeline); StorageInfo[extraid][2][sMats] = strval(szResult);

					cache_get_field_content(row,  "PSFPot", szResult, MainPipeline); PlayerInfo[extraid][pPSFPot] = strval(szResult);
					cache_get_field_content(row,  "PSFCrack", szResult, MainPipeline); PlayerInfo[extraid][pPSFCrack] = strval(szResult);
					cache_get_field_content(row,  "PSFMats", szResult, MainPipeline); PlayerInfo[extraid][pPSFMats] = strval(szResult);*/

					for(new i = 0; i < MAX_PLAYERVEHICLES; i++)
					{
						format(szField, sizeof(szField), "pv%dModelId", i);
						cache_get_field_content(row,  szField, szResult, MainPipeline);
						PlayerVehicleInfo[extraid][i][pvModelId] = strval(szResult);

						if(PlayerVehicleInfo[extraid][i][pvModelId] != 0)
						{
							format(szField, sizeof(szField), "pv%dPosX", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvPosX] = floatstr(szResult);

							format(szField, sizeof(szField), "pv%dPosY", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvPosY] = floatstr(szResult);

							format(szField, sizeof(szField), "pv%dPosZ", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvPosZ] = floatstr(szResult);

							format(szField, sizeof(szField), "pv%dPosAngle", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvPosAngle] = floatstr(szResult);

							format(szField, sizeof(szField), "pv%dLock", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvLock] = strval(szResult);

							format(szField, sizeof(szField), "pv%dLocked", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvLocked] = strval(szResult);

							format(szField, sizeof(szField), "pv%dPaintJob", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvPaintJob] = strval(szResult);

							format(szField, sizeof(szField), "pv%dColor1", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvColor1] = strval(szResult);

							format(szField, sizeof(szField), "pv%dColor2", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvColor2] = strval(szResult);

							format(szField, sizeof(szField), "pv%dPrice", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvPrice] = strval(szResult);

							format(szField, sizeof(szField), "pv%dTicket", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvTicket] = strval(szResult);

							format(szField, sizeof(szField), "pv%dRestricted", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvRestricted] = strval(szResult);

							format(szField, sizeof(szField), "pv%dWeapon0", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvWeapons][0] = strval(szResult);

							format(szField, sizeof(szField), "pv%dWeapon1", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvWeapons][1] = strval(szResult);

							format(szField, sizeof(szField), "pv%dWeapon2", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvWeapons][2] = strval(szResult);

							format(szField, sizeof(szField), "pv%dWepUpgrade", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvWepUpgrade] = strval(szResult);

							format(szField, sizeof(szField), "pv%dFuel", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvFuel] = floatstr(szResult);

							format(szField, sizeof(szField), "pv%dImpound", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvImpounded] = strval(szResult);

							format(szField, sizeof(szField), "pv%dDisabled", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerVehicleInfo[extraid][i][pvDisabled] = strval(szResult);

							format(szField, sizeof(szField), "pv%dPlate", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							format(PlayerVehicleInfo[extraid][i][pvPlate], 32, "%s", szResult, MainPipeline);

							for(new m = 0; m < MAX_MODS; m++)
							{
								format(szField, sizeof(szField), "pv%dMod%d", i, m);
								cache_get_field_content(row,  szField, szResult, MainPipeline);
								PlayerVehicleInfo[extraid][i][pvMods][m] = strval(szResult);
							}
						}
						else
						{
							PlayerVehicleInfo[extraid][i][pvPosX] = 0.0;
							PlayerVehicleInfo[extraid][i][pvPosY] = 0.0;
							PlayerVehicleInfo[extraid][i][pvPosZ] = 0.0;
							PlayerVehicleInfo[extraid][i][pvPosAngle] = 0.0;
							PlayerVehicleInfo[extraid][i][pvLock] = 0;
							PlayerVehicleInfo[extraid][i][pvLocked] = 0;
							PlayerVehicleInfo[extraid][i][pvPaintJob] = 0;
							PlayerVehicleInfo[extraid][i][pvColor1] = 0;
							PlayerVehicleInfo[extraid][i][pvColor2] = 0;
							PlayerVehicleInfo[extraid][i][pvPrice] = 0;
							PlayerVehicleInfo[extraid][i][pvTicket] = 0;
							PlayerVehicleInfo[extraid][i][pvWeapons][0] = 0;
							PlayerVehicleInfo[extraid][i][pvWeapons][1] = 0;
							PlayerVehicleInfo[extraid][i][pvWeapons][2] = 0;
							PlayerVehicleInfo[extraid][i][pvWepUpgrade] = 0;
							PlayerVehicleInfo[extraid][i][pvFuel] = 0.0;
							PlayerVehicleInfo[extraid][i][pvImpounded] = 0;
							PlayerVehicleInfo[extraid][i][pvSpawned] = 0;
							PlayerVehicleInfo[extraid][i][pvDisabled] = 0;
							PlayerVehicleInfo[extraid][i][pvPlate] = 0;

							for(new m = 0; m < MAX_MODS; m++)
							{
								PlayerVehicleInfo[extraid][i][pvMods][m] = 0;
							}
						}
					}

					for(new i = 0; i < MAX_PLAYERTOYS; i++)
					{
						format(szField, sizeof(szField), "pt%dModelID", i);
						cache_get_field_content(row,  szField, szResult, MainPipeline);
						PlayerToyInfo[extraid][i][ptModelID] = strval(szResult);

						if(PlayerToyInfo[extraid][i][ptModelID] != 0)
						{
							format(szField, sizeof(szField), "pt%dBone", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptBone] = strval(szResult);

							format(szField, sizeof(szField), "pt%dPosX", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptPosX] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dPosY", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptPosY] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dPosY", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptPosY] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dPosZ", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptPosZ] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dRotX", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptRotX] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dRotY", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptRotY] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dRotZ", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptRotZ] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dScaX", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptScaleX] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dScaY", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptScaleY] = floatstr(szResult);

							format(szField, sizeof(szField), "pt%dScaZ", i);
							cache_get_field_content(row,  szField, szResult, MainPipeline);
							PlayerToyInfo[extraid][i][ptScaleZ] = floatstr(szResult);
						}
						else
						{
							PlayerToyInfo[extraid][i][ptBone] = 0;
							PlayerToyInfo[extraid][i][ptPosX] = 0.0;
							PlayerToyInfo[extraid][i][ptPosY] = 0.0;
							PlayerToyInfo[extraid][i][ptPosZ] = 0.0;
							PlayerToyInfo[extraid][i][ptRotX] = 0.0;
							PlayerToyInfo[extraid][i][ptRotY] = 0.0;
							PlayerToyInfo[extraid][i][ptRotZ] = 0.0;
							PlayerToyInfo[extraid][i][ptScaleX] = 0.0;
							PlayerToyInfo[extraid][i][ptScaleY] = 0.0;
							PlayerToyInfo[extraid][i][ptScaleZ] = 0.0;
						}
					}
					g_mysql_LoadPVehiclePositions(extraid);
                	break;
				}
			}
			return 1;
		}
		case SENDDATA_THREAD:
		{
			if(GetPVarType(extraid, "RestartKick")) {
				gPlayerLogged{extraid} = 0;
				GameTextForPlayer(extraid, "Scheduled Maintenance...", 5000, 5);
				SendClientMessage(extraid, COLOR_LIGHTBLUE, "* May chu se duoc Tat va theo lich bao tri. Chung toi se mo lai sau.");
				SendClientMessage(extraid, COLOR_GRAD2, "Chung toi se lam theo lich bao tri may chu/script, chung toi se mo lai sau khi hoan thanh.");
				Kick(extraid);

				foreachex(Player, extraid) if(gPlayerLogged{extraid}) {
					SetPVarInt(extraid, "RestartKick", 1);
					return OnPlayerStatsUpdate(extraid);
				}
				ABroadCast(COLOR_YELLOW, "{AA3333}Bao tri{FFFF00}: Tai khoan da duoc luu!", 1);
				//g_mysql_DumpAccounts();

				SetTimer("FinishMaintenance", 15000, false);
			}
			if(GetPVarType(extraid, "AccountSaving") && (GetPVarInt(extraid, "AccountSaved") == 0)) {
				SetPVarInt(extraid, "AccountSaved", 1);
				foreachex(Player, extraid)
				{
					if(gPlayerLogged{extraid} && (GetPVarInt(extraid, "AccountSaved") == 0))
					{
						SetPVarInt(extraid, "AccountSaving", 1);
						return OnPlayerStatsUpdate(extraid);
					}
				}
				ABroadCast(COLOR_YELLOW, "{AA3333}Bao tri{FFFF00}: Tai khoan da duoc luu!", 1);
				print("Tai khoan da duoc luu thanh cong");
				foreach(new i: Player)
				{
				    DeletePVar(i, "AccountSaved");
				    DeletePVar(i, "AccountSaving");
				}
				//g_mysql_DumpAccounts();
			}
			return 1;
		}
		case AUTH_THREAD:
		{
			new name[24];
			for(new i;i < rows;i++)
			{
				cache_get_field_content(i, "Username", name, MainPipeline);
				if(strcmp(name, GetPlayerNameExt(extraid), true) == 0)
				{
					HideNoticeGUIFrame(extraid);
					SafeLogin(extraid, 1);
					return 1;
				}
				else
				{
					return 1;
				}
			}
			HideNoticeGUIFrame(extraid);
			SafeLogin(extraid, 2);
			return 1;
		}
		case LOGIN_THREAD:
		{
			for(new i;i < rows;i++)
			{
				new
					szPass[129],
					szResult[129],
					szBuffer[129],
					szEmail[256];

				cache_get_field_content(i, "Username", szResult, MainPipeline);
				if(strcmp(szResult, GetPlayerNameExt(extraid), true) != 0)
				{
					//g_mysql_AccountAuthCheck(extraid);
					return 1;
				}

				cache_get_field_content(i, "Email", szEmail, MainPipeline);
				cache_get_field_content(i, "Key", szResult, MainPipeline);
				GetPVarString(extraid, "PassAuth", szBuffer, sizeof(szBuffer));
				WP_Hash(szPass, sizeof(szPass), szBuffer);

				if(isnull(szEmail)) SetPVarInt(extraid, "NullEmail", 1);

				if((isnull(szPass)) || (isnull(szResult)) || (strcmp(szPass, szResult) != 0)) {
					// Invalid Password - Try Again!
					ShowMainMenuDialog(extraid, 3);
					HideNoticeGUIFrame(extraid);
					if(++gPlayerLogTries[extraid] == 2) {
						SendClientMessage(extraid, COLOR_RED, "SERVER: Sai mat khau,ban da bi tu dong kick khoi may chu.");
						Kick(extraid);
					}
					return 1;
				}
				DeletePVar(extraid, "PassAuth");
				break;
			}
			HideNoticeGUIFrame(extraid);
			g_mysql_LoadAccount(extraid);
			return 1;
		}
		case DANGNHAP_MAPIN:
		{
		    new titlestring[64];
			new string[512];
			for(new i;i < rows;i++)
			{
				new
					szMatkhau[129],
					szResult[129],
					szMapin[129];

				cache_get_field_content(i, "Username", szResult, MainPipeline);
				if(strcmp(szResult, GetPlayerNameExt(extraid), true) != 0)
				{
					//g_mysql_AccountAuthCheck(extraid);
					return 1;
				}

				cache_get_field_content(i, "Mapin", szResult, MainPipeline);
				GetPVarString(extraid, "PassMaPin", szMapin, sizeof(szMapin));
				ShowPlayerDialog(extraid, DIALOG_SHOP, DIALOG_STYLE_LIST,"Cua hang OOC","The Kinh Ngiem [5 - Diem] - Gia 10 Coin\nThe Exp X2 (1 the - 20 Coin)\nThe Giam Han Che Vu Khi (1 the - 5 Coin)\nShop Token{FFFFFF}\nShop Toys\nVIP\nPhuong tien","Mua","Thoat");
				WP_Hash(szMatkhau, sizeof(szMatkhau), szMapin);


				if((isnull(szMatkhau)) || (isnull(szResult)) || (strcmp(szMatkhau, szResult) != 0))
				{
				    format(titlestring, sizeof(titlestring), "He thong xac thuc ma pin - %s", GetPlayerNameEx(extraid));
					format(string, sizeof(string), "{FFFFFF}Chao mung ban den voi He Thong OOC SHOP Next Generation Roleplay %s\n\nTai khoan cua ban da duoc dang ky ma pin xin vui long nhap ma pin", GetPlayerNameEx(extraid));
					ShowPlayerDialog(extraid,DIALOG_PINSHOP,DIALOG_STYLE_PASSWORD,titlestring,string,"Dang nhap","Thoat");
					if(++gPlayerLogTries[extraid] == 2)
					{
						SendClientMessage(extraid, COLOR_RED, "[He Thong OOCSHOP]: Ban da nhap sai mat khau.");
					}
					return 1;
				}
				DeletePVar(extraid, "PassMaPin");
				break;
			}
			return 1;
		}
		case REGISTER_THREAD:
		{
			if(IsPlayerConnected(extraid))
			{
				g_mysql_AccountLoginCheck(extraid);
				TotalRegister++;
			}
		}
		case DANGKY_MAPIN:
		{
			if(IsPlayerConnected(extraid))
			{
				g_mysql_AccountMaPin(extraid);
			}
		}
		case LOADPVEHPOS_THREAD:
		{
			if(IsPlayerConnected(extraid))
			{
				new bool:bVehRestore;
				for(new i;i < rows;i++)
				{
					bVehRestore = true;
					for(new v; v < MAX_PLAYERVEHICLES; v++)
					{
						new szResult[32], szPrefix[32], tmpVehModelId, Float:tmpVehArray[4];

						format(szPrefix, sizeof(szPrefix), "pv%dModelId", v);
						cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehModelId = strval(szResult);
						format(szPrefix, sizeof(szPrefix), "pv%dPosX", v);
						cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[0] = floatstr(szResult);
						format(szPrefix, sizeof(szPrefix), "pv%dPosY", v);
						cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[1] = floatstr(szResult);
						format(szPrefix, sizeof(szPrefix), "pv%dPosZ", v);
						cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[2] = floatstr(szResult);
						format(szPrefix, sizeof(szPrefix), "pv%dPosAngle", v);
						cache_get_field_content(i, szPrefix, szResult, MainPipeline); tmpVehArray[3] = floatstr(szResult);

						if(tmpVehModelId >= 400)
						{
							printf("Stored %d Vehicle Slot", v);

							format(szPrefix, sizeof(szPrefix), "tmpVeh%dModelId", v);
							SetPVarInt(extraid, szPrefix, tmpVehModelId);

							format(szPrefix, sizeof(szPrefix), "tmpVeh%dPosX", v);
							SetPVarFloat(extraid, szPrefix, tmpVehArray[0]);

							format(szPrefix, sizeof(szPrefix), "tmpVeh%dPosY", v);
							SetPVarFloat(extraid, szPrefix, tmpVehArray[1]);

							format(szPrefix, sizeof(szPrefix), "tmpVeh%dPosZ", v);
							SetPVarFloat(extraid, szPrefix, tmpVehArray[2]);

							format(szPrefix, sizeof(szPrefix), "tmpVeh%dAngle", v);
							SetPVarFloat(extraid, szPrefix, tmpVehArray[3]);
						}
					}
					break;
				}

				if(bVehRestore == true) {
					// person Vehicle Position Restore Granted, Now Purge them from the Table.
					new query[128];
					format(query, sizeof(query), "DELETE FROM `pvehpositions` WHERE `id`='%d'", PlayerInfo[extraid][pId]);
					mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, extraid);
				}

				OnPlayerLoad(extraid);
			}
		}
		case CHECKPVEHPOS_THREAD:
		{
				new tmpRows, tmpFields;
				cache_get_data(tmpRows, tmpFields, MainPipeline);

				if(rows == 0)
				{
					new query[2048];
					format(query, sizeof(query), "INSERT INTO `pvehpositions` (id,");
					for(new v; v < MAX_PLAYERVEHICLES; v++)
					{
						if(v == MAX_PLAYERVEHICLES-1) format(query, sizeof(query), "%s pv%dModelId, pv%dPosX, pv%dPosY, pv%dPosZ, pv%dPosAngle", query, v, v, v, v, v);
						else format(query, sizeof(query), "%s pv%dModelId, pv%dPosX, pv%dPosY, pv%dPosZ, pv%dPosAngle, ", query, v, v, v, v, v);

					}
					format(query, sizeof(query), "%s) VALUES (%d,", query, tmpPVASQLID[extraid]);
					for(new v; v < MAX_PLAYERVEHICLES; v++)
					{
						if(v == MAX_PLAYERVEHICLES-1) format(query, sizeof(query), "%s %d, %f, %f, %f, %f)", query, tmpPVAModelID[extraid][v], tmpPVAPos[extraid][v][0], tmpPVAPos[extraid][v][1], tmpPVAPos[extraid][v][2], tmpPVAPos[extraid][v][3]);
						else format(query, sizeof(query), "%s %d, %f, %f, %f, %f,", query, tmpPVAModelID[extraid][v], tmpPVAPos[extraid][v][0], tmpPVAPos[extraid][v][1], tmpPVAPos[extraid][v][2], tmpPVAPos[extraid][v][3]);
					}

					for(new v; v < MAX_PLAYERVEHICLES; v++)
					{
						tmpPVASQLID[extraid] = -1;
						tmpPVAModelID[extraid][v] = 0;
						tmpPVAPos[extraid][v][0] = 0;
						tmpPVAPos[extraid][v][1] = 0;
						tmpPVAPos[extraid][v][2] = 0;
						tmpPVAPos[extraid][v][3] = 0;
					}

					mysql_function_query(MainPipeline, query, false, "OnQueryFinish", "ii", SENDDATA_THREAD, extraid);
				}
		}
		case LOADCRATE_THREAD:
		{
      		for(new i; i < rows; i++)
		    {
				new crateid, szResult[32], string[128];
				cache_get_field_content(i, "id", szResult, MainPipeline); crateid = strval(szResult);
				cache_get_field_content(i, "Active", szResult, MainPipeline); CrateInfo[crateid][crActive] = strval(szResult);
				cache_get_field_content(i, "CrateX", szResult, MainPipeline); CrateInfo[crateid][crX] = strval(szResult);
				cache_get_field_content(i, "CrateY", szResult, MainPipeline); CrateInfo[crateid][crY] = strval(szResult);
				cache_get_field_content(i, "CrateZ", szResult, MainPipeline); CrateInfo[crateid][crZ] = strval(szResult);
				cache_get_field_content(i, "GunQuantity", szResult, MainPipeline); CrateInfo[crateid][GunQuantity] = strval(szResult);
				cache_get_field_content(i, "InVehicle", szResult, MainPipeline); CrateInfo[crateid][InVehicle] = strval(szResult);
       			if( crateid > 0 && crateid < 20 )
    			{
				    if(CrateInfo[crateid][InVehicle] != INVALID_VEHICLE_ID)
			    	{
       				 CrateInfo[crateid][crActive] = 0;
				        CrateInfo[crateid][InVehicle] = INVALID_VEHICLE_ID;
				    }
				}
				if(CrateInfo[crateid][crActive])
   				{
 				 	CrateInfo[crateid][InVehicle] = INVALID_VEHICLE_ID;
       				CrateInfo[crateid][crObject] = CreateDynamicObject(964,CrateInfo[crateid][crX],CrateInfo[crateid][crY],CrateInfo[crateid][crZ],0.00000000,0.00000000,0.00000000);
			        format(string, sizeof(string), "Serial Number: #%d\n High Grade Materials: %d/50", i, CrateInfo[i][GunQuantity]);
			        CrateInfo[crateid][crLabel] = CreateDynamic3DTextLabel(string, COLOR_ORANGE, CrateInfo[crateid][crX],CrateInfo[crateid][crY],CrateInfo[crateid][crZ]+1, 20.0, _, _, 1, 0, 0, _, 20.0);
				}
			}
		    print("[LoadCrates] Loading Crates Finished");
	    	mysql_SaveCrates();
  		}
	}
	return 1;
}
nguyenquynh is offline   Reply With Quote