MYSQL Cars dont load
#1

Hello,

I have a problem with the MYSQL Car load System
if i start the Server the Cars dont load
here the source
Message 1 is come
Message 2 dont come
Code:
for(new count=1;count<MAX_VEHICLES;count++)
	{
 		new carloadstring[256];
		format(carloadstring,sizeof(carloadstring),"FahrzeugID='%d'",count);
		printf("string geht");
		if (QueryMySQL("*","autos",carloadstring,"")<0)
		{
		  printf("query geht");
			while(mysql_fetch_row(mysqlresult))
			{
			  printf("fetchen geht");
				Autos[count][vModel] = GetMySQLField_Int("Model");
			  Autos[count][vEingepackt] = GetMySQLField_Int("Eingepackt");
			  Autos[count][vArt] = GetMySQLField_Int("Art");
			  Autos[count][vX] = GetMySQLField_Float("X");
			  Autos[count][vY] = GetMySQLField_Float("Y");
			  Autos[count][vZ] = GetMySQLField_Float("Z");
			  Autos[count][vA] = GetMySQLField_Float("A");
			  Autos[count][vFarbe1] = GetMySQLField_Int("Farbe1");
			  Autos[count][vFarbe2] = GetMySQLField_Int("Farbe2");
			  Autos[count][vVerkauf] = GetMySQLField_Int("Verkauf");
			  Autos[count][vPreis] = GetMySQLField_Int("Preis");
			  Autos[count][vKMStand] = GetMySQLField_Int("KMStand")*450;
			  Autos[count][vRKMStand] = GetMySQLField_Int("RKMStand")*450;
			  strcpy(Autos[count][vBesitzer],GetMySQLField("Besitzer"));
			  strcpy(Autos[count][vSch1],GetMySQLField("Sch1"));
			  strcpy(Autos[count][vSch2],GetMySQLField("Sch2"));
			  strcpy(Autos[count][vSch3],GetMySQLField("Sch3"));
			  Autos[count][vBeschlagnahmt] = GetMySQLField_Int("Art");
			  Autos[count][vBX] = GetMySQLField_Float("BX");
			  Autos[count][vBY] = GetMySQLField_Float("BY");
			  Autos[count][vBZ] = GetMySQLField_Float("BZ");
			  Autos[count][vBA] = GetMySQLField_Float("BA");
			  Autos[count][vRespawn] = GetMySQLField_Int("Respawn");
			  Autos[count][vZustand] = GetMySQLField_Float("Zustand");
			  Autos[count][vMS] = GetMySQLField_Int("MS");
			  Autos[count][vTankDrin] = GetMySQLField_Int("TankDrin");
			  Autos[count][vTankMax] = GetMySQLField_Int("TankMax");
			  Autos[count][vBenzin] = GetMySQLField_Int("Benzin");
			  Autos[count][vVW] = GetMySQLField_Int("VirtualWorld");
			  Autos[count][vMJ] = GetMySQLField_Int("MiniJob");
			  Autos[count][vFC] = GetMySQLField_Int("FreeCar");
			  printf("LADEN geht");
			  if (Autos[count][vEingepackt] == 0)
			  	{
			  	  if (Autos[count][vBeschlagnahmt] == 0)
			  		{
						CreateVehicle(Autos[count][vModel],Autos[count][vX],Autos[count][vY],Autos[count][vZ],Autos[count][vA],Autos[count][vFarbe1],Autos[count][vFarbe2],Autos[count][vRespawn]);
						SetVehicleVirtualWorld(count,Autos[count][vVW]);
					}
					else
					{
		          CreateVehicle(Autos[count][vModel],Autos[count][vX],Autos[count][vY],Autos[count][vZ],Autos[count][vA],Autos[count][vFarbe1],Autos[count][vFarbe2],Autos[count][vRespawn]);
		          SetVehicleVirtualWorld(count,Autos[count][vVW]);
					}
				}
				else if (Autos[count][vEingepackt] == 1 && Autos[count][vArt] == 1)
				{
				  CreateVehicle(591,Autos[count][vX],Autos[count][vY],Autos[count][vZ],Autos[count][vA],Autos[count][vFarbe1],Autos[count][vFarbe2],-1);
				  SetVehicleVirtualWorld(count,Autos[count][vVW]);
				}
				else if (Autos[count][vEingepackt] == 1&& Autos[count][vArt] == 2)
				{
					CreateVehicle(591,Autos[count][vX],Autos[count][vY],Autos[count][vZ],Autos[count][vA],Autos[count][vFarbe1],Autos[count][vFarbe2],-1);
					SetVehicleVirtualWorld(count,Autos[count][vVW]);
				}
				else if (Autos[count][vEingepackt] == 1 && Autos[count][vArt] == 3)
				{
					CreateVehicle(591,Autos[count][vX],Autos[count][vY],Autos[count][vZ],Autos[count][vA],Autos[count][vFarbe1],Autos[count][vFarbe2],-1);
					SetVehicleVirtualWorld(count,Autos[count][vVW]);
				}
				Meters[count] = Autos[count][vKMStand];
				RMeters[count] = Autos[count][vRKMStand];
				if(Autos[count][vMS] == 1)
				{
				  SetVehicleHealth(count,300);
				}
				else
				{
				  if(Autos[count][vFC] == 1 || Autos[count][vMJ] == 1)
				  {
				  		SetVehicleHealth(count,1000);
				  	}
				  	else
				  	{
				  	  SetVehicleHealth(count,Autos[count][vZustand]);
					}
				}
				VgasDrin[count] = Autos[count][vTankDrin];
				VgasMax[count] = Autos[count][vTankMax];
				SaveCoords(count);
				return 1;
			}
		}
		return 1;
	}
Here is QueryMySQL
Code:
stock QueryMySQL(field[],table[],where[],option[])
{
	new sqltemp[256],query[256];
	format(sqltemp,sizeof(sqltemp),"SELECT %s FROM %s",field,table);
	if (strlen(where)>0) {format(sqltemp,sizeof(sqltemp),"%s WHERE %s",sqltemp,where);}
	if (strlen(option)>0) {format(sqltemp,sizeof(sqltemp),"%s %s",sqltemp,option);}
	format(sqltemp,sizeof(sqltemp),"%s;",sqltemp);
	if (mysql_ping()!=0) {if (!OpenMySQL()) {return 0;}}
//	print(sqltemp);
	mysql_real_escape_string(sqltemp, query);mysql_query(sqltemp);mysql_store_result();
	return mysql_num_rows();
}
sry for bad english

-Dedi
Reply
#2

no-one can help??
pls i need it fast
Reply
#3

really? No-One its about 5000 Members in this Forum and
noone can help me oO
pls
Reply
#4

Just one comment:
Shouldn't it be:
pawn Code:
if (QueryMySQL("*","autos",carloadstring,"")>0)
instead of:
pawn Code:
if (QueryMySQL("*","autos",carloadstring,"")<0)
O.o

And: What plugin are you using? :O
Reply
#5

already the self problem

my MYSQL plugin

my MYSQL Include
Reply
#6

push
Reply
#7

if no-one can help me by this problem
than he can write me a better system to
create cars to mysql
update cars in mysql
load cars from mysql

anyone knows what i mean?

-dedi
Reply
#8

plsss help
i mean a very good Vehicle Car Owner Ship with MYSQL
Reply
#9

You're sure that you have a connection to the mySQL Server? :O

When yes: Try:
pawn Code:
if(QueryMySQL("*","autos","","") > 0)
Reply
#10

yes MYSQL is connected
but i ts already not work
can anyone write me a better Car Ownership for MYSQL??
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)