Jump to content
  • 0

Problema masini personale


Andrei_Zx

Question

Problema: Am o problema la masinile personale, uneori se multiplica, alteori le spawnez si dispar aiurea, apoi cand vreau sa le dau towcar zice 'Car is in use', desii masina mea nu a fost furata. Mai este o chestie si cand dau find car se pune checkpointul pe masina altcuiva, cred ca se incurca cumva id-urile..

Cod sursa: Banuiesc ca problema ar fi de la stock-ul insertcar, aveti aici codu pastebin.com/7EuaCtrk sau de la LoadCar, am niste erori in Mysql_Log, i.imgur.com/vg30Lsy.png cum as putea sa le rezolv?

 

Aici este LocateCar

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);
}

 

 

Multumesc mult.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
  • 0
La 2/27/2017 la 12:36, WiDuAlK a spus:

cred ca pe langa


i                            = cache_get_field_content_int(c, "ID");

ar mai trebui sa specifici o interogatie mysql de genu:

mysql_format(parametrii, " SELECT * FROM `personalcar` WHERE `ID` = '%e'", i);

apoi sa faci load-ul pentru ca ar trebui specificata fiecare masina cu exactitate in timpul iteratiei.

Poate '%d' nu '%e' ca nu e string ca sa faci escape.

Sinner.png

Link to comment
Share on other sites

  • 0
  • 0
Acum 23 ore, WiDuAlK a spus:

merge si cu %e, eu faceam asa la id jucatorilor din baza de date si functiona perfect

Ti-am zis asa pentru ca nu are rost sa folosesti escape pe un ID care e integer si care nu o sa contina vreodata sql injection etc.

Sinner.png

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.