Please help me to fix [load-mysql]
#1

Please help me to fix load MYSQL

Код:
// carregar factions
CarregarFactions() {
    for(new facid; facid < MAX_FACTIONS; facid++)
    {
        new query[50]; // Nгo precisa ser enorme como vocк tinha colocado; Precisa apenas caber sua query dentro dela
        mysql_format(ConnectMYSQL, query, sizeof(query), "SELECT * FROM factions WHERE ID = %d", facid);
        mysql_function_query(ConnectMYSQL, query, true, "Carregar_Factions","i",facid);
    }
}

stock Carregar_Factions() {
    new string[256], rows, fields;
    cache_get_data(rows, fields);
    if(rows)
    {
        new string_dest[30];
		cache_get_field_content(0, "facname", string_dest);           FactionInfo[facid][facname] = string_dest;
		
        new string_lider1[30];
		cache_get_field_content(0, "lider1", string_lider1);           FactionInfo[facid][lider1] = string_lider1;
        new string_lider2[30];
		cache_get_field_content(0, "lider2", string_lider2);           FactionInfo[facid][lider2] = string_lider2;
        new string_lider3[30];
		cache_get_field_content(0, "lider3", string_lider3);           FactionInfo[facid][lider3] = string_lider3;
		
        new string_membro[600];
		cache_get_field_content(0, "membro1", string_membro);           FactionInfo[facid][membro1] = string_membro;
		cache_get_field_content(0, "membro2", string_membro);           FactionInfo[facid][membro2] = string_membro;
		cache_get_field_content(0, "membro3", string_membro);           FactionInfo[facid][membro3] = string_membro;
		cache_get_field_content(0, "membro4", string_membro);           FactionInfo[facid][membro4] = string_membro;
		cache_get_field_content(0, "membro5", string_membro);           FactionInfo[facid][membro5] = string_membro;
		cache_get_field_content(0, "membro6", string_membro);           FactionInfo[facid][membro6] = string_membro;
		cache_get_field_content(0, "membro7", string_membro);           FactionInfo[facid][membro7] = string_membro;
		cache_get_field_content(0, "membro8", string_membro);           FactionInfo[facid][membro8] = string_membro;
		cache_get_field_content(0, "membro9", string_membro);           FactionInfo[facid][membro9] = string_membro;
		cache_get_field_content(0, "membro10", string_membro);           FactionInfo[facid][membro10] = string_membro;
		cache_get_field_content(0, "membro11", string_membro);           FactionInfo[facid][membro11] = string_membro;
		cache_get_field_content(0, "membro12", string_membro);           FactionInfo[facid][membro12] = string_membro;
		
		new Float:float_dest[3];
		float_dest[0] = cache_get_field_content_float(0, "HQposX");     	FactionInfo[facid][HQposX] = float_dest[0];
		float_dest[1] = cache_get_field_content_float(0, "HQposY");     	FactionInfo[facid][HQposY] = float_dest[1];
		float_dest[2] = cache_get_field_content_float(0, "HQposZ");     	FactionInfo[facid][HQposZ] = float_dest[2];
		
		new int_dest[15];
		int_dest[1] = cache_get_field_content_int(0, "hq");         FactionInfo[facid][hq] = int_dest[1];
		int_dest[2] = cache_get_field_content_int(0, "cofredinheiro");         FactionInfo[facid][cofredinheiro] = int_dest[2];
		int_dest[3] = cache_get_field_content_int(0, "cofresalario");         FactionInfo[facid][cofresalario] = int_dest[3];
		int_dest[4] = cache_get_field_content_int(0, "cofrematerial");         FactionInfo[facid][cofrematerial] = int_dest[4];
		int_dest[5] = cache_get_field_content_int(0, "cofremaconha");         FactionInfo[facid][cofremaconha] = int_dest[5];
		int_dest[6] = cache_get_field_content_int(0, "EagleSPAWNfac");         FactionInfo[facid][EagleSPAWNfac] = int_dest[6];
		int_dest[7] = cache_get_field_content_int(0, "shotgunSPAWNfac");      	FactionInfo[facid][shotgunSPAWNfac] = int_dest[7];
		int_dest[8] = cache_get_field_content_int(0, "spazSPAWNfac");         	FactionInfo[facid][spazSPAWNfac] = int_dest[8];
		int_dest[9] = cache_get_field_content_int(0, "mp5SPAWNfac");           FactionInfo[facid][mp5SPAWNfac] = int_dest[9];
		int_dest[10] = cache_get_field_content_int(0, "akSPAWNfac");            FactionInfo[facid][akSPAWNfac] = int_dest[10];
		int_dest[11] = cache_get_field_content_int(0, "m4SPAWNfac");            FactionInfo[facid][m4SPAWNfac] = int_dest[11];
		int_dest[12] = cache_get_field_content_int(0, "rifleSPAWNfac");         FactionInfo[facid][rifleSPAWNfac] = int_dest[12];
		int_dest[13] = cache_get_field_content_int(0, "sniperSPAWNfac");        FactionInfo[facid][sniperSPAWNfac] = int_dest[13];
		int_dest[14] = cache_get_field_content_int(0, "meleeSPAWNfac");         FactionInfo[facid][meleeSPAWNfac] = int_dest[14];
    }
}
Reply
#2

Try this model
PHP код:
stock Carregar_Factions() 
{
    new 
i0Cache:result3 mysql_query(handle,"SELECT * FROM `factions` ORDER BY `factions`.`ID` ASC");
    for(
0cache_get_row_count(); i++)
    {
             
cache_get_field_content(i"facname",temp);     format(FactionInfo[x][facname] , 128temp);

    }
    
cache_delete(result3);
    print(
"=============================================================");
    
printf("        We Loaded %i factions"x);
    print(
"=============================================================\n");
    return 
1;

Reply
#3

dont work my bro, no prints on console, but i rep u
Reply
#4

Using latest MySQL Plugin Version is recommended but i fix your code too:
PHP код:
// carregar factions
CarregarFactions() {
    for(new 
facidfacid MAX_FACTIONSfacid++)
    {
        new 
query[50]; // Nгo precisa ser enorme como vocк tinha colocado; Precisa apenas caber sua query dentro dela
        
mysql_format(ConnectMYSQLquerysizeof(query), "SELECT * FROM factions WHERE ID = %d"facid);
        
mysql_function_query(ConnectMYSQLquerytrue"Carregar_Factions","i",facid);
    }
}
stock Carregar_Factions(facid) {
    new 
string[256], rowsfields;
    
cache_get_data(rowsfields);
    if(
rows)
    {
        new 
string_dest[30];
        
cache_get_field_content(0"facname"string_dest);           FactionInfo[facid][facname] = string_dest;
        
        new 
string_lider1[30];
        
cache_get_field_content(0"lider1"string_lider1);           FactionInfo[facid][lider1] = string_lider1;
        new 
string_lider2[30];
        
cache_get_field_content(0"lider2"string_lider2);           FactionInfo[facid][lider2] = string_lider2;
        new 
string_lider3[30];
        
cache_get_field_content(0"lider3"string_lider3);           FactionInfo[facid][lider3] = string_lider3;
        
        new 
string_membro[600];
        
cache_get_field_content(0"membro1"string_membro);           FactionInfo[facid][membro1] = string_membro;
        
cache_get_field_content(0"membro2"string_membro);           FactionInfo[facid][membro2] = string_membro;
        
cache_get_field_content(0"membro3"string_membro);           FactionInfo[facid][membro3] = string_membro;
        
cache_get_field_content(0"membro4"string_membro);           FactionInfo[facid][membro4] = string_membro;
        
cache_get_field_content(0"membro5"string_membro);           FactionInfo[facid][membro5] = string_membro;
        
cache_get_field_content(0"membro6"string_membro);           FactionInfo[facid][membro6] = string_membro;
        
cache_get_field_content(0"membro7"string_membro);           FactionInfo[facid][membro7] = string_membro;
        
cache_get_field_content(0"membro8"string_membro);           FactionInfo[facid][membro8] = string_membro;
        
cache_get_field_content(0"membro9"string_membro);           FactionInfo[facid][membro9] = string_membro;
        
cache_get_field_content(0"membro10"string_membro);           FactionInfo[facid][membro10] = string_membro;
        
cache_get_field_content(0"membro11"string_membro);           FactionInfo[facid][membro11] = string_membro;
        
cache_get_field_content(0"membro12"string_membro);           FactionInfo[facid][membro12] = string_membro;
        
        new 
Float:float_dest[3];
        
float_dest[0] = cache_get_field_content_float(0"HQposX");         FactionInfo[facid][HQposX] = float_dest[0];
        
float_dest[1] = cache_get_field_content_float(0"HQposY");         FactionInfo[facid][HQposY] = float_dest[1];
        
float_dest[2] = cache_get_field_content_float(0"HQposZ");         FactionInfo[facid][HQposZ] = float_dest[2];
        
        new 
int_dest[15];
        
int_dest[1] = cache_get_field_content_int(0"hq");         FactionInfo[facid][hq] = int_dest[1];
        
int_dest[2] = cache_get_field_content_int(0"cofredinheiro");         FactionInfo[facid][cofredinheiro] = int_dest[2];
        
int_dest[3] = cache_get_field_content_int(0"cofresalario");         FactionInfo[facid][cofresalario] = int_dest[3];
        
int_dest[4] = cache_get_field_content_int(0"cofrematerial");         FactionInfo[facid][cofrematerial] = int_dest[4];
        
int_dest[5] = cache_get_field_content_int(0"cofremaconha");         FactionInfo[facid][cofremaconha] = int_dest[5];
        
int_dest[6] = cache_get_field_content_int(0"EagleSPAWNfac");         FactionInfo[facid][EagleSPAWNfac] = int_dest[6];
        
int_dest[7] = cache_get_field_content_int(0"shotgunSPAWNfac");          FactionInfo[facid][shotgunSPAWNfac] = int_dest[7];
        
int_dest[8] = cache_get_field_content_int(0"spazSPAWNfac");             FactionInfo[facid][spazSPAWNfac] = int_dest[8];
        
int_dest[9] = cache_get_field_content_int(0"mp5SPAWNfac");           FactionInfo[facid][mp5SPAWNfac] = int_dest[9];
        
int_dest[10] = cache_get_field_content_int(0"akSPAWNfac");            FactionInfo[facid][akSPAWNfac] = int_dest[10];
        
int_dest[11] = cache_get_field_content_int(0"m4SPAWNfac");            FactionInfo[facid][m4SPAWNfac] = int_dest[11];
        
int_dest[12] = cache_get_field_content_int(0"rifleSPAWNfac");         FactionInfo[facid][rifleSPAWNfac] = int_dest[12];
        
int_dest[13] = cache_get_field_content_int(0"sniperSPAWNfac");        FactionInfo[facid][sniperSPAWNfac] = int_dest[13];
        
int_dest[14] = cache_get_field_content_int(0"meleeSPAWNfac");         FactionInfo[facid][meleeSPAWNfac] = int_dest[14];
    }

Reply
#5

Quote:
Originally Posted by Aliassassin123456
Посмотреть сообщение
Using latest MySQL Plugin Version is recommended but i fix your code too:
PHP код:
// carregar factions
CarregarFactions() {
    for(new 
facidfacid MAX_FACTIONSfacid++)
    {
        new 
query[50]; // Nгo precisa ser enorme como vocк tinha colocado; Precisa apenas caber sua query dentro dela
        
mysql_format(ConnectMYSQLquerysizeof(query), "SELECT * FROM factions WHERE ID = %d"facid);
        
mysql_function_query(ConnectMYSQLquerytrue"Carregar_Factions","i",facid);
    }
}
stock Carregar_Factions(facid) {
    new 
string[256], rowsfields;
    
cache_get_data(rowsfields);
    if(
rows)
    {
        new 
string_dest[30];
        
cache_get_field_content(0"facname"string_dest);           FactionInfo[facid][facname] = string_dest;
        
        new 
string_lider1[30];
        
cache_get_field_content(0"lider1"string_lider1);           FactionInfo[facid][lider1] = string_lider1;
        new 
string_lider2[30];
        
cache_get_field_content(0"lider2"string_lider2);           FactionInfo[facid][lider2] = string_lider2;
        new 
string_lider3[30];
        
cache_get_field_content(0"lider3"string_lider3);           FactionInfo[facid][lider3] = string_lider3;
        
        new 
string_membro[600];
        
cache_get_field_content(0"membro1"string_membro);           FactionInfo[facid][membro1] = string_membro;
        
cache_get_field_content(0"membro2"string_membro);           FactionInfo[facid][membro2] = string_membro;
        
cache_get_field_content(0"membro3"string_membro);           FactionInfo[facid][membro3] = string_membro;
        
cache_get_field_content(0"membro4"string_membro);           FactionInfo[facid][membro4] = string_membro;
        
cache_get_field_content(0"membro5"string_membro);           FactionInfo[facid][membro5] = string_membro;
        
cache_get_field_content(0"membro6"string_membro);           FactionInfo[facid][membro6] = string_membro;
        
cache_get_field_content(0"membro7"string_membro);           FactionInfo[facid][membro7] = string_membro;
        
cache_get_field_content(0"membro8"string_membro);           FactionInfo[facid][membro8] = string_membro;
        
cache_get_field_content(0"membro9"string_membro);           FactionInfo[facid][membro9] = string_membro;
        
cache_get_field_content(0"membro10"string_membro);           FactionInfo[facid][membro10] = string_membro;
        
cache_get_field_content(0"membro11"string_membro);           FactionInfo[facid][membro11] = string_membro;
        
cache_get_field_content(0"membro12"string_membro);           FactionInfo[facid][membro12] = string_membro;
        
        new 
Float:float_dest[3];
        
float_dest[0] = cache_get_field_content_float(0"HQposX");         FactionInfo[facid][HQposX] = float_dest[0];
        
float_dest[1] = cache_get_field_content_float(0"HQposY");         FactionInfo[facid][HQposY] = float_dest[1];
        
float_dest[2] = cache_get_field_content_float(0"HQposZ");         FactionInfo[facid][HQposZ] = float_dest[2];
        
        new 
int_dest[15];
        
int_dest[1] = cache_get_field_content_int(0"hq");         FactionInfo[facid][hq] = int_dest[1];
        
int_dest[2] = cache_get_field_content_int(0"cofredinheiro");         FactionInfo[facid][cofredinheiro] = int_dest[2];
        
int_dest[3] = cache_get_field_content_int(0"cofresalario");         FactionInfo[facid][cofresalario] = int_dest[3];
        
int_dest[4] = cache_get_field_content_int(0"cofrematerial");         FactionInfo[facid][cofrematerial] = int_dest[4];
        
int_dest[5] = cache_get_field_content_int(0"cofremaconha");         FactionInfo[facid][cofremaconha] = int_dest[5];
        
int_dest[6] = cache_get_field_content_int(0"EagleSPAWNfac");         FactionInfo[facid][EagleSPAWNfac] = int_dest[6];
        
int_dest[7] = cache_get_field_content_int(0"shotgunSPAWNfac");          FactionInfo[facid][shotgunSPAWNfac] = int_dest[7];
        
int_dest[8] = cache_get_field_content_int(0"spazSPAWNfac");             FactionInfo[facid][spazSPAWNfac] = int_dest[8];
        
int_dest[9] = cache_get_field_content_int(0"mp5SPAWNfac");           FactionInfo[facid][mp5SPAWNfac] = int_dest[9];
        
int_dest[10] = cache_get_field_content_int(0"akSPAWNfac");            FactionInfo[facid][akSPAWNfac] = int_dest[10];
        
int_dest[11] = cache_get_field_content_int(0"m4SPAWNfac");            FactionInfo[facid][m4SPAWNfac] = int_dest[11];
        
int_dest[12] = cache_get_field_content_int(0"rifleSPAWNfac");         FactionInfo[facid][rifleSPAWNfac] = int_dest[12];
        
int_dest[13] = cache_get_field_content_int(0"sniperSPAWNfac");        FactionInfo[facid][sniperSPAWNfac] = int_dest[13];
        
int_dest[14] = cache_get_field_content_int(0"meleeSPAWNfac");         FactionInfo[facid][meleeSPAWNfac] = int_dest[14];
    }

Im using i think
And it don't work my brother

Ty to try help, +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)