Jump to content
  • 0

Probelma LoadCar


Try22

Question

Problema: Primesc niste erori in mysql log de la public-ul LoadCar, tot incercand sa ii dau de cap am scos o linie, aceea fiind "i = cache_get_field_content_int(c, "ID");". Dupa ce am scos aceasta linie erorile au incetat, daca m-ați ajuta sa le rezolv v-aș ramane recunoscator.
Cod sursa:

public LoadCar()
{
	new i;
	new rezultate = cache_get_row_count();
    for(new c; c <= sizeof(CarInfo); c++)
    {
		if(rezultate >= c)
		{
			i                            = cache_get_field_content_int(c, "ID");
			if(i != 0)
			{
				CarInfo[i][cModel]                          = cache_get_field_content_int(c, "Model");
				CarInfo[i][cLocationx]                      = cache_get_field_content_float(c, "Locationx");
				CarInfo[i][cLocationy]                      = cache_get_field_content_float(c, "Locationy");
				CarInfo[i][cLocationz]                      = cache_get_field_content_float(c, "Locationz");
				CarInfo[i][cAngle]                          = cache_get_field_content_float(c, "Angle");
				CarInfo[i][cColorOne]                       = cache_get_field_content_int(c, "ColorOne");
				CarInfo[i][cColorTwo]                       = cache_get_field_content_int(c, "ColorTwo");
				cache_get_field_content(c, "Owner", CarInfo[i][cOwner], SQL, 130);
				CarInfo[i][cValue]                          = cache_get_field_content_int(c, "Value");
				cache_get_field_content(c, "License", CarInfo[i][cLicense], SQL, 130);
				cache_get_field_content(c, "Description", CarInfo[i][cDescription], SQL, 130);
				CarInfo[i][cLock]                          	= cache_get_field_content_int(c, "Lockk");
				CarInfo[i][cNewEngine]                      = cache_get_field_content_int(c, "NewEngine");
				CarInfo[i][cTimed]                          = cache_get_field_content_int(c, "Timed");
				CarInfo[i][cInscarprice]                    = cache_get_field_content_int(c, "Inscarprice");
				CarInfo[i][cInsurancecar]                   = cache_get_field_content_int(c, "Insurancecar");
				CarInfo[i][cKM]                             = cache_get_field_content_float(c, "KM");
				CarInfo[i][cHP]                             = cache_get_field_content_float(c, "HP");
				CarInfo[i][cDamage1]                        = cache_get_field_content_int(c, "Damage1");
				CarInfo[i][cDamage2]                        = cache_get_field_content_int(c, "Damage2");
				CarInfo[i][cDamage3]                        = cache_get_field_content_int(c, "Damage3");
				CarInfo[i][cDamage4]                        = cache_get_field_content_int(c, "Damage4");
				CarInfo[i][cGas]                        	= cache_get_field_content_int(c, "Gas");
				CarInfo[i][cOwned]                          = cache_get_field_content_int(c, "Owned");
				CarInfo[i][cSell]                           = cache_get_field_content_int(c, "Sell");
				CarInfo[i][mod1]                            = cache_get_field_content_int(c, "mod1");
				CarInfo[i][mod2]                            = cache_get_field_content_int(c, "mod2");
				CarInfo[i][mod3]                            = cache_get_field_content_int(c, "mod3");
				CarInfo[i][mod4]                            = cache_get_field_content_int(c, "mod4");
				CarInfo[i][mod5]                            = cache_get_field_content_int(c, "mod5");
				CarInfo[i][mod6]                            = cache_get_field_content_int(c, "mod6");
				CarInfo[i][mod7]                            = cache_get_field_content_int(c, "mod7");
				CarInfo[i][mod8]                            = cache_get_field_content_int(c, "mod8");
				CarInfo[i][mod9]                            = cache_get_field_content_int(c, "mod9");
				CarInfo[i][mod10]                           = cache_get_field_content_int(c, "mod10");
				CarInfo[i][mod11]                           = cache_get_field_content_int(c, "mod11");
				CarInfo[i][mod12]                           = cache_get_field_content_int(c, "mod12");
				CarInfo[i][mod13]                           = cache_get_field_content_int(c, "mod13");
				CarInfo[i][mod14]                           = cache_get_field_content_int(c, "mod14");
				CarInfo[i][mod15]                           = cache_get_field_content_int(c, "mod15");
				CarInfo[i][mod16]                           = cache_get_field_content_int(c, "mod16");
				CarInfo[i][mod17]                           = cache_get_field_content_int(c, "mod17");
				CarInfo[i][cDays]                           = cache_get_field_content_int(c, "days");
				CarInfo[i][cPaintJ]                         = cache_get_field_content_int(c, "PaintJ");
				CarInfo[i][vArma1]                          = cache_get_field_content_int(c, "Arma1");
				CarInfo[i][vArma2]                          = cache_get_field_content_int(c, "Arma2");
				CarInfo[i][vArma3]                          = cache_get_field_content_int(c, "Arma3");
				CarInfo[i][vGArma1]                         = cache_get_field_content_int(c, "GArma1");
				CarInfo[i][vGArma2]                         = cache_get_field_content_int(c, "GArma2");
				CarInfo[i][vGArma3]                         = cache_get_field_content_int(c, "GArma3");
				CarInfo[i][vDroguri]                        = cache_get_field_content_int(c, "Droguri");
				CarInfo[i][vBani]                        	= cache_get_field_content_int(c, "Bani");
				masini = i;
			}
		}
	}
	printf("Ultimul ID incarcat din tabelul `cars`: %d", masini);
}

 

Erori/atentionari: m.imgur.com/vg30Lsy?r
Alte detalii: Multumesc mult.

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0
public LoadCar()
{
	new i = 0, z = cache_get_row_count(), zx;
    for(i; i < z; i++)
    {
		if(z > 0)
		{
			zx                            					= cache_get_field_content_int(i, "ID");
			if(zx != 0)
			{
				CarInfo[i][cModel]                          = cache_get_field_content_int(z, "Model");
				CarInfo[i][cLocationx]                      = cache_get_field_content_float(z, "Locationx");
				CarInfo[i][cLocationy]                      = cache_get_field_content_float(z, "Locationy");
				CarInfo[i][cLocationz]                      = cache_get_field_content_float(z, "Locationz");
				CarInfo[i][cAngle]                          = cache_get_field_content_float(z, "Angle");
				CarInfo[i][cColorOne]                       = cache_get_field_content_int(z, "ColorOne");
				CarInfo[i][cColorTwo]                       = cache_get_field_content_int(z, "ColorTwo");
				cache_get_field_content(z, "Owner", CarInfo[i][cOwner], SQL, 130);
				CarInfo[i][cValue]                          = cache_get_field_content_int(z, "Value");
				cache_get_field_content(z, "License", CarInfo[i][cLicense], SQL, 130);
				cache_get_field_content(z, "Description", CarInfo[i][cDescription], SQL, 130);
				CarInfo[i][cLock]                          	= cache_get_field_content_int(z, "Lockk");
				CarInfo[i][cNewEngine]                      = cache_get_field_content_int(z, "NewEngine");
				CarInfo[i][cTimed]                          = cache_get_field_content_int(z, "Timed");
				CarInfo[i][cInscarprice]                    = cache_get_field_content_int(z, "Inscarprice");
				CarInfo[i][cInsurancecar]                   = cache_get_field_content_int(z, "Insurancecar");
				CarInfo[i][cKM]                             = cache_get_field_content_float(z, "KM");
				CarInfo[i][cHP]                             = cache_get_field_content_float(z, "HP");
				CarInfo[i][cDamage1]                        = cache_get_field_content_int(z, "Damage1");
				CarInfo[i][cDamage2]                        = cache_get_field_content_int(z, "Damage2");
				CarInfo[i][cDamage3]                        = cache_get_field_content_int(z, "Damage3");
				CarInfo[i][cDamage4]                        = cache_get_field_content_int(z, "Damage4");
				CarInfo[i][cGas]                        	= cache_get_field_content_int(z, "Gas");
				CarInfo[i][cOwned]                          = cache_get_field_content_int(z, "Owned");
				CarInfo[i][cSell]                           = cache_get_field_content_int(z, "Sell");
				CarInfo[i][mod1]                            = cache_get_field_content_int(z, "mod1");
				CarInfo[i][mod2]                            = cache_get_field_content_int(z, "mod2");
				CarInfo[i][mod3]                            = cache_get_field_content_int(z, "mod3");
				CarInfo[i][mod4]                            = cache_get_field_content_int(z, "mod4");
				CarInfo[i][mod5]                            = cache_get_field_content_int(z, "mod5");
				CarInfo[i][mod6]                            = cache_get_field_content_int(z, "mod6");
				CarInfo[i][mod7]                            = cache_get_field_content_int(z, "mod7");
				CarInfo[i][mod8]                            = cache_get_field_content_int(z, "mod8");
				CarInfo[i][mod9]                            = cache_get_field_content_int(z, "mod9");
				CarInfo[i][mod10]                           = cache_get_field_content_int(z, "mod10");
				CarInfo[i][mod11]                           = cache_get_field_content_int(z, "mod11");
				CarInfo[i][mod12]                           = cache_get_field_content_int(z, "mod12");
				CarInfo[i][mod13]                           = cache_get_field_content_int(z, "mod13");
				CarInfo[i][mod14]                           = cache_get_field_content_int(z, "mod14");
				CarInfo[i][mod15]                           = cache_get_field_content_int(z, "mod15");
				CarInfo[i][mod16]                           = cache_get_field_content_int(z, "mod16");
				CarInfo[i][mod17]                           = cache_get_field_content_int(z, "mod17");
				CarInfo[i][cDays]                           = cache_get_field_content_int(z, "days");
				CarInfo[i][cPaintJ]                         = cache_get_field_content_int(z, "PaintJ");
				CarInfo[i][vArma1]                          = cache_get_field_content_int(z, "Arma1");
				CarInfo[i][vArma2]                          = cache_get_field_content_int(z, "Arma2");
				CarInfo[i][vArma3]                          = cache_get_field_content_int(z, "Arma3");
				CarInfo[i][vGArma1]                         = cache_get_field_content_int(z, "GArma1");
				CarInfo[i][vGArma2]                         = cache_get_field_content_int(z, "GArma2");
				CarInfo[i][vGArma3]                         = cache_get_field_content_int(z, "GArma3");
				CarInfo[i][vDroguri]                        = cache_get_field_content_int(z, "Droguri");
				CarInfo[i][vBani]                        	= cache_get_field_content_int(z, "Bani");
				masini = i;
			}
		}
	}
	printf("Ultimul ID incarcat din tabelul `cars`: %d", masini);
}
      
Si la OnGameModeInit trebuie sa ai ceva de genu:
      
mysql_format(SQL, query, sizeof(query), "SELECT * FROM `cars` LIMIT 0, 100");
mysql_tquery(SQL, query, "LoadCar", "");

 

Link to comment
Share on other sites

  • 0
Acum 7 ore, Try22 a spus:

Problema: Primesc niste erori in mysql log de la public-ul LoadCar, tot incercand sa ii dau de cap am scos o linie, aceea fiind "i = cache_get_field_content_int(c, "ID");". Dupa ce am scos aceasta linie erorile au incetat, daca m-ați ajuta sa le rezolv v-aș ramane recunoscator.
Cod sursa:


public LoadCar()
{
	new i;
	new rezultate = cache_get_row_count();
    for(new c; c <= sizeof(CarInfo); c++)
    {
		if(rezultate >= c)
		{
			i                            = cache_get_field_content_int(c, "ID");
			if(i != 0)
			{
				CarInfo[i][cModel]                          = cache_get_field_content_int(c, "Model");
				

Salut, incearca sa definesti functia asa si poate iti va merge.

Citat

    masini = cache_num_rows();

    for(new i = 1; i <= masini; i++)

    {

        new c = i - 1;

        CarInfo[cID]                             = cache_get_field_content_int(c, "ID");

Erori/atentionari: m.imgur.com/vg30Lsy?r
Alte detalii: Multumesc mult.

 

FiveGame  Lands

Pawno Developer, Mapping , Scripter

Since 2016

Link to comment
Share on other sites

  • 0
3 hours ago, Try22. said:

Tot primesc acele erori, am incercat ambele variante..

for(new i = 1; i <= masini; i++)  asta o inlocuiesti cu:

for(new i = 0; i < masini; i++)

**********************************

Servicii Scripting de calitate:

*********************************

Future Project: ExpertGame

*********************************

Link to comment
Share on other sites

  • 0

Am facut si asa

 

public LoadCar()
{
                    new z = cache_get_row_count(), zx;
                    for(new i=0; i < z; i++)
                   {
                            if(z > 0)
                             {
                                        zx   = cache_get_field_content_int(i, "ID");
                                        if(zx != 0)
                                      {
 
                                       codurile mele
 
                                     }
                          }
                }
printf("Ultimul ID incarcat din tabelul `cars`: %d", masini);
}

Si asa

public LoadCar()
{
    masini = cache_num_rows();
    for(new i = 1; i <= masini; i++)
    {
 
         codurile mele
 
    }
printf("Cars: %d", masini);
}

Si tot primesc acele erori, chiar nu inteleg ce are..

Link to comment
Share on other sites

  • 0
forward LoadPersonalVehicle();
public LoadPersonalVehicle() {
	new Cache: result = mysql_query(SQL, "SELECT * FROM cars");
	new
        i,
        id,
        rows = cache_num_rows();

    if(rows > 0) {
		for(i = 0; i < rows; i++)
		{
			id 							= cache_get_field_content_int(i, "ID");
			CarInfo[i][cLocationx] 		= cache_get_field_content_float(id, "Locationx");
		}
		printf("Numar masini personale: %d | Ultima incarcata ID %d", rows, id);
    }

	cache_delete(result);
	return 1;
}

Incearca asa, sper sa te ajute !

Link to comment
Share on other sites

  • 0
public LoadCar()
{
    cars = cache_num_rows();
    new x,y;
    for(x=1;x<=cars;x++)
    {
           y = x - 1;
        cache_get_field_content(y,"ID", temp); CarInfo[x][vCarID] = strval(temp); // vCarID il adaugi tu
        cache_get_field_content(y,"Owner", temp); format(CarInfo[x][vOwner], 24, temp);
        cache_get_field_content(y,"Locationx", temp); CarInfo[x][cLocationx] = floatstr(temp);
    }
    printf("Masini incarcate: %i.", cars);
    return 1;
}

Si la Ongamemodeinit:

mysql_tquery(handle, "SELECT * FROM  `cars` ORDER BY `ID` ASC", "LoadCar");

Poti incerca si metoda aceasta, mi se pare mai usoara.

Edited by andy47
  • Upvote 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.