Jump to content
  • 0

Mysql r5 pe r39-3


Jimmi

Question

Problema intalnita (descriere): M-am gandit sa trec si eu dupa 6 luni de server pe r39-3.Nu ma prea descurc dar incerc si eu...
Ero(area / rile) / warning-(ul / urile): Sunt mai multe si al sbiz-uri dar acolo le rezolv eu daca am un model
Liniile de cod / sursa / script-ul(obligatoriu):

public LoadBizz()
{
    new biss;
    new result[100],index = 0;
    new query[256];
    format(query, sizeof(query), "SELECT * FROM `bizz` ORDER BY `bizz`.`ID` ASC");
    mysql_query(query);
    mysql_store_result();
    while(mysql_retrieve_row())
    {
        biss++;
        index++;
        new i = index;
        mysql_get_field("Owned", result);            BizzInfo[i][bOwned] = strval(result);//Scuze ca ma uit, dar nu am mai lucrat de ceva timp cu r6//no problem oricum n-aveam ce face
        mysql_get_field("Owner", result);            strmid(BizzInfo[i][bOwner], result, 0, 32, 32);
        mysql_get_field("Message", result);            strmid(BizzInfo[i][bMessage], result, 0, 60, 60);
        mysql_get_field("Extortion", result);       strmid(BizzInfo[i][bExtortion], result, 0, 32, 32);
        mysql_get_field("EntX", result);            BizzInfo[i][bEntranceX] = floatstr(result);
        mysql_get_field("EntY", result);            BizzInfo[i][bEntranceY] = floatstr(result);
        mysql_get_field("EntZ", result);            BizzInfo[i][bEntranceZ] = floatstr(result);
        mysql_get_field("ExitX", result);            BizzInfo[i][bExitX] = floatstr(result);
        mysql_get_field("ExitY", result);            BizzInfo[i][bExitY] = floatstr(result);
        mysql_get_field("ExitZ", result);            BizzInfo[i][bExitZ] = floatstr(result);
        mysql_get_field("Level", result);            BizzInfo[i][bLevelNeeded] = strval(result);
        mysql_get_field("Price", result);            BizzInfo[i][bBuyPrice] = strval(result);
        mysql_get_field("EPrice", result);            BizzInfo[i][bEntranceCost] = strval(result);
        mysql_get_field("Till", result);            BizzInfo[i][bTill] = strval(result);
        mysql_get_field("Locked", result);            BizzInfo[i][bLocked] = strval(result);
        mysql_get_field("Interior", result);        BizzInfo[i][bInterior] = strval(result);
        mysql_get_field("Products", result);        BizzInfo[i][bProducts] = strval(result);
        mysql_get_field("MaxProducts", result);        BizzInfo[i][bMaxProducts] = strval(result);
        mysql_get_field("ProductPrice", result);    BizzInfo[i][bPriceProd] = strval(result);
    }
    mysql_free_result();
    printf("[BIZZ]Au fost incarcate %d bizz-uri.Felicitari pentru reusita.[PG-ZONE.RO]", index);
    return 1;
}

Imagini / Video (optional):
Ati incercat sa rezolvati singur?: Da 
Edited by jimmi
Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

Se mai uita cineva?am incercat sa fac dupa un sistem mai vechi dintr-un gm dar tot sunt erori...

public LoadBizz()
{
    new biss;
    new index = 0;
    new query[256];
    format(query,sizeof(query),"SELECT * FROM `bizz` ORDER BY `bizz`.`ID` ASC");
    mysql_tquery(handle, query, "", "");
    if(cache_get_row_count(handle))
    while(mysql_retrieve_row())
    {
        biss++;
        index++;
        new i = index;
        cache_get_field_content_int("Owned",            BizzInfo[i][bOwned] = strval(handle);
        cache_get_field_content_int("Owner",    strmid(BizzInfo[i][bOwner], handle, 0, 32, 32);
        cache_get_field_content_int("Message",            strmid(BizzInfo[i][bMessage], handle, 0, 60, 60);
        cache_get_field_content_int("Extortion",       strmid(BizzInfo[i][bExtortion], handle, 0, 32, 32);
        cache_get_field_content_int("EntX",             BizzInfo[i][bEntranceX] = floatstr(handle);
        cache_get_field_content_int("EntY",            BizzInfo[i][bEntranceY] = floatstr(handle);
        cache_get_field_content_int("EntZ",            BizzInfo[i][bEntranceZ] = floatstr(handle);
        cache_get_field_content_int("ExitX",            BizzInfo[i][bExitX] = floatstr(handle);
        cache_get_field_content_int("ExitY",        BizzInfo[i][bExitY] = floatstr(handle);
        cache_get_field_content_int("ExitZ",            BizzInfo[i][bExitZ] = floatstr(handle);
        cache_get_field_content_int("Level",            BizzInfo[i][bLevelNeeded] = strval(handle);
        cache_get_field_content_int("Price",            BizzInfo[i][bBuyPrice] = strval(handle);
        cache_get_field_content_int("EPrice",        BizzInfo[i][bEntranceCost] = strval(handle);
        cache_get_field_content_int("Till",             BizzInfo[i][bTill] = strval(handle);
        cache_get_field_content_int("Locked",             BizzInfo[i][bLocked] = strval(handle);
        cache_get_field_content_int("Interior",     BizzInfo[i][bInterior] = strval(handle);
        cache_get_field_content_int("Products",        BizzInfo[i][bProducts] = strval(handle);
        cache_get_field_content_int("MaxProducts",    BizzInfo[i][bMaxProducts] = strval(handle);
        cache_get_field_content_int("ProductPrice",    BizzInfo[i][bPriceProd] = strval(handle);
    }
    mysql_free_result();
    printf("[BIZZ]Au fost incarcate %d bizz-uri.Felicitari pentru reusita.[PG-ZONE.RO]", index);
    return 1;
}
Edited by jimmi
Link to comment
Share on other sites

  • 0

incearca ceva de genu:

public LoadBizz()
{
	new query[256], rows, fields, temp[200];
	cache_get_data(rows, fields, handle);
   
    mysql_format(handle,query,sizeof(query),"SELECT * FROM `bizz` ");
	mysql_query(handle, query);

	for (new i = 0; i < rows; i++)
    {
        BizzInfo[i + 1][bOwned] = cache_get_field_content(i,"Owned", temp);
		BizzInfo[i + 1][bOwner] = cache_get_field_content(i,"Owner", temp);
		//liniile tale
        BizzInfo[i + 1][bEntranceX] = cache_get_field_content_int(i, "EntX"); 
		// etc
    }
    printf("[BIZZ]Au fost incarcate %d bizz-uri.Felicitari pentru reusita.[PG-ZONE.RO]", rows);
    return 1;
}

 

Link to comment
Share on other sites

  • 0

incearca ceva de genu:

public LoadBizz()
{
	new query[256], rows, fields, temp[200];
	cache_get_data(rows, fields, handle);
   
    mysql_format(handle,query,sizeof(query),"SELECT * FROM `bizz` ");
	mysql_query(handle, query);

	for (new i = 0; i < rows; i++)
    {
        BizzInfo[i + 1][bOwned] = cache_get_field_content(i,"Owned", temp);
		BizzInfo[i + 1][bOwner] = cache_get_field_content(i,"Owner", temp);
		//liniile tale
        BizzInfo[i + 1][bEntranceX] = cache_get_field_content_int(i, "EntX"); 
		// etc
    }
    printf("[BIZZ]Au fost incarcate %d bizz-uri.Felicitari pentru reusita.[PG-ZONE.RO]", rows);
    return 1;
}

 

 

Functia mea, hahahahaha.

 

Am pus-o eu mai jos explicata.

MySQL_LoadBusinesses()
{
	new Query[32 + 1], Rows, Cache:cache; // Initializam variabilele.

	mysql_format(MySQLHandle, Query, sizeof(Query), "SELECT * FROM `businesses`"); // Formatam un text pentru interogare.
	cache = mysql_query(MySQLHandle, Query, true); // Executam interogarea si rezultatul ei il pastram in cache.

	cache_set_active(cache); // Setam cache-ul activ pe variabila 'cache'.
	Rows = cache_num_rows(); // Preluam numarul de randuri stocate in cache.

	for (new i = 0; i < Rows; i++) // Mergem prin toate randurile.
	{
		BusinessInfo[i + 1][bMySQLID] = cache_get_field_content_int(i, "ID");// Preluam ID-ul afacerii din baza de date si il putem pe pozitia 'i + 1' pentru ca vrem sa plecam cu el de la 1.
		cache_get_field_content(i, "OwnerName", BusinessInfo[i + 1][bOwnerName]); // Preluam numele detinatorului.
		// etc..

	}

	cache_set_active(Cache:0); // Ne setam pe cache-ul 0 care nu este nimic.
	cache_delete(cache); // Stergem cache-ul din variabila 'cache' sa eliberam memoria.
}

 

Tu trebuie s-o adaptezi.

Eu acolo am

cache_set_active(cache);

pentru ca mai chem functii si din alte thread-uri. Nu stiu daca e necesar s-o pui.

Link to comment
Share on other sites

  • 0

 

Functia mea, hahahahaha.

 

Am pus-o eu mai jos explicata.

MySQL_LoadBusinesses()
{
	new Query[32 + 1], Rows, Cache:cache; // Initializam variabilele.

	mysql_format(MySQLHandle, Query, sizeof(Query), "SELECT * FROM `businesses`"); // Formatam un text pentru interogare.
	cache = mysql_query(MySQLHandle, Query, true); // Executam interogarea si rezultatul ei il pastram in cache.

	cache_set_active(cache); // Setam cache-ul activ pe variabila 'cache'.
	Rows = cache_num_rows(); // Preluam numarul de randuri stocate in cache.

	for (new i = 0; i < Rows; i++) // Mergem prin toate randurile.
	{
		BusinessInfo[i + 1][bMySQLID] = cache_get_field_content_int(i, "ID");// Preluam ID-ul afacerii din baza de date si il putem pe pozitia 'i + 1' pentru ca vrem sa plecam cu el de la 1.
		cache_get_field_content(i, "OwnerName", BusinessInfo[i + 1][bOwnerName]); // Preluam numele detinatorului.
		// etc..

	}

	cache_set_active(Cache:0); // Ne setam pe cache-ul 0 care nu este nimic.
	cache_delete(cache); // Stergem cache-ul din variabila 'cache' sa eliberam memoria.
}

 

Tu trebuie s-o adaptezi.

Eu acolo am

cache_set_active(cache);

pentru ca mai chem functii si din alte thread-uri. Nu stiu daca e necesar s-o pui.

pai de aceea nu am pus-o , pentru ca nu e necesar

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.