Why don't load/save MYSQL?
#1

What's worng on my code? Why it don't load? And don't save?

logs when start
Код:
[21:41:51] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM factions", callback: "Carregar_Factions", format: "(null)"
[21:41:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:41:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:41:51] [DEBUG] CMySQLConnection::Connect - establishing connection to database...
[21:41:51] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:41:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:41:51] [DEBUG] CMySQLQuery::Execute[Carregar_Factions] - starting query execution
[21:41:51] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:41:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:41:51] [DEBUG] CMySQLConnection::Connect - connection was successful
[21:41:51] [DEBUG] CMySQLConnection::Connect - auto-reconnect has been enabled
[21:41:52] [DEBUG] CMySQLQuery::Execute[Carregar_Factions] - query was successfully executed within 19.732 milliseconds
[21:41:52] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[21:41:52] [DEBUG] Calling callback "Carregar_Factions"..
[21:41:52] [DEBUG] cache_get_row_count - connection: 1
[21:41:52] [DEBUG] cache_get_row_count - connection: 1
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "facname", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "facname", data: "Eight Gaming"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "lider1", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "lider1", data: "[8G]Tiago"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "lider2", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "lider2", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "lider3", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "lider3", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro1", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro1", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro2", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro2", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro3", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro3", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro4", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro4", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro5", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro5", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro6", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro6", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro7", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro7", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro8", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro8", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro9", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro9", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro10", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro10", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro11", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro11", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content - row: 0, field_name: "membro12", connection: 1, max_len: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "membro12", data: "Empty"
[21:41:52] [DEBUG] cache_get_field_content_float - row: 0, field_name: "HQposX", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "HQposX", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_float - row: 0, field_name: "HQposY", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "HQposY", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_float - row: 0, field_name: "HQposZ", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "HQposZ", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "hq", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "hq", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "cofredinheiro", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "cofredinheiro", data: "2000"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "cofresalario", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "cofresalario", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "cofrematerial", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "cofrematerial", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "cofremaconha", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "cofremaconha", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "EagleSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "EagleSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "shotgunSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "shotgunSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "spazSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "spazSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "mp5SPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "mp5SPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "akSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "akSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "m4SPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "m4SPAWNfac", data: "1"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "rifleSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "rifleSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "sniperSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "sniperSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_field_content_int - row: 0, field_name: "meleeSPAWNfac", connection: 1
[21:41:52] [DEBUG] CMySQLResult::GetRowDataByName - row: '0', field: "meleeSPAWNfac", data: "0"
[21:41:52] [DEBUG] cache_get_row_count - connection: 1
[21:41:52] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
To load (ongamemodeinit)
Код:
CarregarFactions()
{
    mysql_tquery(ConnectMYSQL, "SELECT * FROM factions", "Carregar_Factions", "");
    return 1;
}

forward Carregar_Factions();
public Carregar_Factions()
{
    if(!cache_num_rows()) return 0;
    for(new row; row < cache_num_rows(); row++) {
		cache_get_field_content(row, "facname", FactionInfo[row][facname]);
		cache_get_field_content(row, "lider1", FactionInfo[row][lider1]);
		cache_get_field_content(row, "lider2", FactionInfo[row][lider2]);
		cache_get_field_content(row, "lider3", FactionInfo[row][lider3]);
		cache_get_field_content(row, "membro1", FactionInfo[row][membro1]);
		cache_get_field_content(row, "membro2", FactionInfo[row][membro2]);
		cache_get_field_content(row, "membro3", FactionInfo[row][membro3]);
		cache_get_field_content(row, "membro4", FactionInfo[row][membro4]);
		cache_get_field_content(row, "membro5", FactionInfo[row][membro5]);
		cache_get_field_content(row, "membro6", FactionInfo[row][membro6]);
		cache_get_field_content(row, "membro7", FactionInfo[row][membro7]);
		cache_get_field_content(row, "membro8", FactionInfo[row][membro8]);
		cache_get_field_content(row, "membro9", FactionInfo[row][membro9]);
		cache_get_field_content(row, "membro10", FactionInfo[row][membro10]);
		cache_get_field_content(row, "membro11", FactionInfo[row][membro11]);
		cache_get_field_content(row, "membro12", FactionInfo[row][membro12]);

		FactionInfo[row][HQposX] = cache_get_field_content_float(row, "HQposX");
		FactionInfo[row][HQposY] = cache_get_field_content_float(row, "HQposY");
		FactionInfo[row][HQposZ] = cache_get_field_content_float(row, "HQposZ");

		FactionInfo[row][hq] = cache_get_field_content_int(row, "hq");
		FactionInfo[row][cofredinheiro] = cache_get_field_content_int(row, "cofredinheiro");
		FactionInfo[row][cofresalario] = cache_get_field_content_int(row, "cofresalario");
		FactionInfo[row][cofrematerial] = cache_get_field_content_int(row, "cofrematerial");
		FactionInfo[row][cofremaconha] = cache_get_field_content_int(row, "cofremaconha");
		FactionInfo[row][EagleSPAWNfac] = cache_get_field_content_int(row, "EagleSPAWNfac");
		FactionInfo[row][shotgunSPAWNfac] = cache_get_field_content_int(row, "shotgunSPAWNfac");
		FactionInfo[row][spazSPAWNfac] = cache_get_field_content_int(row, "spazSPAWNfac");
		FactionInfo[row][mp5SPAWNfac] = cache_get_field_content_int(row, "mp5SPAWNfac");
		FactionInfo[row][akSPAWNfac] = cache_get_field_content_int(row, "akSPAWNfac");
		FactionInfo[row][m4SPAWNfac] = cache_get_field_content_int(row, "m4SPAWNfac");
		FactionInfo[row][rifleSPAWNfac] = cache_get_field_content_int(row, "rifleSPAWNfac");
		FactionInfo[row][sniperSPAWNfac] = cache_get_field_content_int(row, "sniperSPAWNfac");
		FactionInfo[row][meleeSPAWNfac] = cache_get_field_content_int(row, "meleeSPAWNfac");
    }
    return 1;
}
Код:
forward SalvarFactions();
public SalvarFactions() {
	for(new factionid; factionid < MAX_FACTIONS; factionid++) {
		new query[1030];
		format(query, sizeof(query), "UPDATE `factions` SET `facname` = '%s', `HQposX` = '%f', `HQposY` = '%f', `HQposZ` = '%f', `EagleSPAWNfac` = '%d', `shotgunSPAWNfac` = '%d', `spazSPAWNfac` = '%d', `mp5SPAWNfac` = '%d', `akSPAWNfac` = '%d', `m4SPAWNfac` = '%d', `rifleSPAWNfac` = '%d', `sniperSPAWNfac` = '%d', `meleeSPAWNfac` = '%d', `cofredinheiro` = '%d', `cofresalario` = '%d', `cofrematerial` = '%d', `cofremaconha` = '%d' WHERE `ID` = '%i' ",
            FactionInfo[factionid][facname],
            FactionInfo[factionid][HQposX],
            FactionInfo[factionid][HQposY],
            FactionInfo[factionid][HQposZ],
            FactionInfo[factionid][EagleSPAWNfac],
            FactionInfo[factionid][shotgunSPAWNfac],
			FactionInfo[factionid][spazSPAWNfac],
			FactionInfo[factionid][mp5SPAWNfac],
			FactionInfo[factionid][akSPAWNfac],
			FactionInfo[factionid][m4SPAWNfac],
			FactionInfo[factionid][rifleSPAWNfac],
			FactionInfo[factionid][sniperSPAWNfac],
			FactionInfo[factionid][meleeSPAWNfac],
			FactionInfo[factionid][cofredinheiro],
			FactionInfo[factionid][cofresalario],
			FactionInfo[factionid][cofrematerial],
			FactionInfo[factionid][ID] );
		mysql_pquery(ConnectMYSQL, query);

		format(query, sizeof(query), "UPDATE `factions` SET `lider1` = '%s', `lider2` = '%s', `lider3` = '%s', `membro1` = '%s', `membro2` = '%s', `membro3` = '%s', `membro4` = '%s', `membro5` = '%s', `membro6` = '%s', `membro7` = '%s', `membro8` = '%s', `membro9` = '%s', `membro10` = '%s', `membro11` = '%s', `membro12` = '%s' WHERE `ID` = '%i' ",
			FactionInfo[factionid][lider1],
			FactionInfo[factionid][lider2],
			FactionInfo[factionid][lider3],
			FactionInfo[factionid][membro1],
			FactionInfo[factionid][membro2],
			FactionInfo[factionid][membro3],
			FactionInfo[factionid][membro4],
			FactionInfo[factionid][membro5],
			FactionInfo[factionid][membro6],
			FactionInfo[factionid][membro7],
			FactionInfo[factionid][membro8],
			FactionInfo[factionid][membro9],
			FactionInfo[factionid][membro10],
			FactionInfo[factionid][membro11],
			FactionInfo[factionid][membro12],
			FactionInfo[factionid][ID] );
		mysql_pquery(ConnectMYSQL, query);
	}
}
Reply


Messages In This Thread
Why don't load/save MYSQL? - by maikons - 23.09.2015, 00:41
Re: Why don't load/save MYSQL? - by maikons - 24.09.2015, 17:22
Re: Why don't load/save MYSQL? - by Aly - 24.09.2015, 17:57
Re: Why don't load/save MYSQL? - by maikons - 25.09.2015, 07:26
Re: Why don't load/save MYSQL? - by Aly - 25.09.2015, 07:38
Re: Why don't load/save MYSQL? - by maikons - 25.09.2015, 17:58
Re: Why don't load/save MYSQL? - by Aly - 25.09.2015, 18:02
Re: Why don't load/save MYSQL? - by maikons - 26.09.2015, 07:58
Re: Why don't load/save MYSQL? - by Aly - 26.09.2015, 12:00
Re: Why don't load/save MYSQL? - by maikons - 26.09.2015, 17:53

Forum Jump:


Users browsing this thread: 1 Guest(s)