An error with mysql.
#3

Alright. This is the part, where the stats of a player gets loaded.
Note, I updated the main post to give a better explenation, but it seems you know what I am talking about.

Код:
stock LoadStats(playerid)
{
    new query[1024], pname[24], savingstring[40];
    GetPlayerName(playerid, pname, 24);
    format(query, sizeof(query), "SELECT * FROM Accounts WHERE Username = '%s'", pname);
    mysql_query(query);
    mysql_store_result();
    while(mysql_fetch_row_format(query,"|"))
    {
        mysql_fetch_field_row(savingstring, "Money"); Player[playerid][Money] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "BankMoney"); Player[playerid][BankMoney] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Level"); Player[playerid][Level] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "AdminLevel"); Player[playerid][AdminLevel] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Faction"); Player[playerid][Faction] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "FactionRank"); Player[playerid][FactionRank] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Wallet"); Player[playerid][Wallet] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "RegistrationStep"); Player[playerid][RegistrationStep] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "BirthDay"); Player[playerid][BirthDay] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "BirthMonth"); Player[playerid][BirthMonth] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "BirthYear"); Player[playerid][BirthYear] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "SpawnPoint"); Player[playerid][SpawnPoint] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "TutorialComplete"); Player[playerid][TutorialComplete] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "HelperLevel"); Player[playerid][HelperLevel] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "Accent"); strmid(Player[playerid][Accent], savingstring, 0, strlen(savingstring), 20);
        mysql_fetch_field_row(savingstring, "MinutesPlayed"); Player[playerid][MinutesPlayed] = strval(savingstring);
        mysql_fetch_field_row(savingstring, "AchievementPoints"); Player[playerid][AchievementPoints] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "ExperiencePoints"); Player[playerid][ExperiencePoints] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "DonatorLevel"); Player[playerid][DonatorLevel] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Deaths"); Player[playerid][Deaths] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Kills"); Player[playerid][Kills] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Clothes1"); Player[playerid][Clothes1] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Clothes2"); Player[playerid][Clothes2] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Clothes3"); Player[playerid][Clothes3] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "ClothesUsed"); Player[playerid][ClothesUsed] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CarLicense"); Player[playerid][CarLicense] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "HouseKey"); Player[playerid][HouseKey] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Business1Key"); Player[playerid][Business1Key] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Business2Key"); Player[playerid][Business2Key] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Banned"); Player[playerid][Banned] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "BanReason"); strmid(Player[playerid][BanReason], savingstring, 0, strlen(savingstring), 128);
		mysql_fetch_field_row(savingstring, "BannedBy"); 
		mysql_fetch_field_row(savingstring, "Radio"); Player[playerid][Radio] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "RadioWave"); Player[playerid][RadioWave] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "SubRank"); strmid(Player[playerid][SubRank], savingstring, 0, strlen(savingstring), 24);
		mysql_fetch_field_row(savingstring, "CellPhone"); Player[playerid][CellPhone] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CellPhoneNumber"); Player[playerid][CellPhoneNumber] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Job"); Player[playerid][Job] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CellBattery"); Player[playerid][CellBattery] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CellPhoneStatus"); Player[playerid][CellPhoneStatus] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CoalMineComplete"); Player[playerid][CoalMineComplete] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Phonebook"); Player[playerid][Phonebook] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Crisps"); Player[playerid][Crisps] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Sprunk"); Player[playerid][Sprunk] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Cigarettes"); Player[playerid][Cigarettes] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Watch"); Player[playerid][Watch] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Mask"); Player[playerid][Mask] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CarKey1"); Player[playerid][CarKey1] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CarKey2"); Player[playerid][CarKey2] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "CarKey3"); Player[playerid][CarKey3] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "TruckLicense"); Player[playerid][TruckLicense] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Fines"); Player[playerid][Fines] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Arrests"); Player[playerid][Arrests] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "JailTime"); Player[playerid][JailTime] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "AJailTime"); Player[playerid][AJailTime] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weed"); Player[playerid][Weed] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Cocaine"); Player[playerid][Cocaine] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Meth"); Player[playerid][Meth] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "WeaponLicense"); Player[playerid][WeaponLicense] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "WeedSeeds"); Player[playerid][WeedSeeds] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "BanHour"); Player[playerid][BanHour] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "BanMinute"); Player[playerid][BanMinute] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon1"); Player[playerid][Weapon1] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon1A"); Player[playerid][Weapon1a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon2"); Player[playerid][Weapon2] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon2A"); Player[playerid][Weapon2a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon3"); Player[playerid][Weapon3] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon3A"); Player[playerid][Weapon3a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon4"); Player[playerid][Weapon4] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon4A"); Player[playerid][Weapon4a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon5"); Player[playerid][Weapon5] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon5A"); Player[playerid][Weapon5a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon6"); Player[playerid][Weapon6] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon6A"); Player[playerid][Weapon6a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon7"); Player[playerid][Weapon7] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon7A"); Player[playerid][Weapon7a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon8"); Player[playerid][Weapon8] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon8A"); Player[playerid][Weapon8a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon9"); Player[playerid][Weapon9] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon9A"); Player[playerid][Weapon9a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon10"); Player[playerid][Weapon10] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon10A"); Player[playerid][Weapon10a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon11"); Player[playerid][Weapon11] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon11A"); Player[playerid][Weapon11a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon12"); Player[playerid][Weapon12] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Weapon12A"); Player[playerid][Weapon12a] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Health"); Player[playerid][Health] = floatstr(savingstring);
		mysql_fetch_field_row(savingstring, "Armour"); Player[playerid][Armour] = floatstr(savingstring);
		mysql_fetch_field_row(savingstring, "FishingRod"); Player[playerid][FishingRod] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Fish1"); Player[playerid][Fish1] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Fish2"); Player[playerid][Fish2] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Fish3"); Player[playerid][Fish3] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Fish4"); Player[playerid][Fish4] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "Fish5"); Player[playerid][Fish5] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "FishBait"); Player[playerid][FishBait] = strval(savingstring);
		mysql_fetch_field_row(savingstring, "FishLicense"); Player[playerid][FishLicense] = strval(savingstring);
    }
    mysql_free_result();
    Logged[playerid] = 1;
    SetTimerEx("StartTimer", 1000, 0, "i", playerid);
    MinuteTimer[playerid] = SetTimerEx("MinuteCount", 60000, 1, "i", playerid);
    return 1;
}
This is the code where the faction vehicle gets saved.

Код:
stock SaveVehicle(Float:VX, Float:VY, Float:VZ, Float:VA, dModel, col1, col2, faction)
{
	new
		Query[512];

	format(Query, sizeof(Query), "INSERT INTO `Vehicles` (VehicleModel, VehicleX, VehicleY, VehicleZ, VehicleAngle, Colour1, Colour2, Faction) VALUES(%d, %f, %f, %f, %f, %i, %i, %i)",
	dModel, VX, VY, VZ, VA, col1, col2, faction);

	mysql_query(Query);
	mysql_free_result();
	return 1;
}
If you need anymore code or a specific code, feel free to ask for, as I really want this to get resolved, as i'm completely clueless on this one.

Edit; I have been wondering... If i do upgrade to the latest mysql version... will it be worth it and *might*, it fix the issue?
Reply


Messages In This Thread
An error with mysql. - by Tessa - 31.08.2013, 10:06
Re: An error with mysql. - by DanishHaq - 31.08.2013, 10:09
Re: An error with mysql. - by Tessa - 31.08.2013, 10:17
Re: An error with mysql. - by Tessa - 31.08.2013, 12:14
Re: An error with mysql. - by DanishHaq - 31.08.2013, 13:42
Re: An error with mysql. - by Tessa - 31.08.2013, 14:10
Re: An error with mysql. - by Tessa - 02.09.2013, 11:35
Re: An error with mysql. - by DanishHaq - 02.09.2013, 11:36
Re: An error with mysql. - by Tessa - 02.09.2013, 11:46
Re: An error with mysql. - by WopsS - 02.09.2013, 11:48

Forum Jump:


Users browsing this thread: 2 Guest(s)