why wont the vehicle load? -
Tanush123 - 18.03.2012
this is the stock
pawn Код:
stock LoadCars()
{
new barcount;
for(new i=1; i<MAX_CARS; i++)
{
format(query,sizeof(query),"SELECT * FROM `Dealership` WHERE `ID` = '%d'",i);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() != 0)
{
barcount ++;
mysql_fetch_row_format(drow, "|");
explode(drow, field, "|");
DealerInfo[i][dID] = strval(field[0]);
DealerInfo[i][Model] = strval(field[1]);
DealerInfo[i][PosX] = floatstr(field[2]);
DealerInfo[i][PosY] = floatstr(field[3]);
DealerInfo[i][PosZ] = floatstr(field[4]);
DealerInfo[i][Ccolor1] = strval(field[5]);
DealerInfo[i][Ccolor2] = strval(field[6]);
DealerInfo[i][Aangle] = strval(field[7]);
DealerInfo[i][Cost] = strval(field[8]);
DealerInfo[i][Car] = CreateVehicle(DealerInfo[i][Model],DealerInfo[i][PosX],DealerInfo[i][PosY],DealerInfo[i][PosZ],DealerInfo[i][Aangle],DealerInfo[i][Ccolor1],DealerInfo[i][Ccolor2],60);
format(str,sizeof(str),"{FF9900}Car ID:{FFFFFF} %d\n{FF9900}Cost:{FFFFFF} %d",DealerInfo[i][dID],DealerInfo[i][Cost]);
DealerInfo[i][dlabel] = Create3DTextLabel(str,-1,X,Y,Z,100,-1,0);
Attach3DTextLabelToVehicle(DealerInfo[i][dlabel],DealerInfo[i][Car],0,0,0);
mysql_free_result();
}
}
return printf("%d dealership cars loaded",barcount);
}
i did the same thing for my dynamic job and organization where the Vehicle spawns but for this it wont spawn.
Re: why wont the vehicle load? -
Shabi RoxX - 18.03.2012
Try this : sscanf is much faster.....
pawn Код:
stock LoadCars()
{
new barcount,query[128];
for(new i=1; i<MAX_CARS; i++)
{
format(query,sizeof(query),"SELECT * FROM `Dealership` WHERE `ID` = '%d'",i);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query, "|"))
{
barcount ++;
sscanf(query, "p<|>e<ddfffdddd>",DealerInfo[i]);
DealerInfo[i][Car] = CreateVehicle(DealerInfo[i][Model],DealerInfo[i][PosX],DealerInfo[i][PosY],DealerInfo[i][PosZ],DealerInfo[i][Aangle],DealerInfo[i][Ccolor1],DealerInfo[i][Ccolor2],60);
format(str,sizeof(str),"{FF9900}Car ID:{FFFFFF} %d\n{FF9900}Cost:{FFFFFF} %d",DealerInfo[i][dID],DealerInfo[i][Cost]);
DealerInfo[i][dlabel] = Create3DTextLabel(str,-1,X,Y,Z,100,-1,0);
Attach3DTextLabelToVehicle(DealerInfo[i][dlabel],DealerInfo[i][Car],0,0,0);
mysql_free_result();
}
}
return printf("%d dealership cars loaded",barcount);
}
Re: why wont the vehicle load? -
Tanush123 - 18.03.2012
I really don't know how to use sscanf with loading. I just only need help with the vehicle that wont spawn, this is my enum
pawn Код:
enum dInfo
{
Text3D:dlabel,
dID,
Model,
Car,
Ccolor1,
Ccolor2,
Cost,
Float:PosX,
Float:PosY,
Float:PosZ,
Float:Aangle,
};
new DealerInfo[MAX_CARS][dInfo];
Re: why wont the vehicle load? -
Shabi RoxX - 18.03.2012
Here you go : Also don't forgot to change name of rows
pawn Код:
stock LoadCars()
{
new barcount,query[128],field,str[128];
for(new i=1; i<MAX_CARS; i++)
{
format(query,sizeof(query),"SELECT * FROM `Dealership` WHERE `ID` = '%d'",i);
mysql_query(query);
mysql_store_result();
while(mysql_fetch_row_format(query, "|"))
{
barcount++;
//Rememeber to change Rows name to your rows name
mysql_fetch_field_row(field, "ID"); DealerInfo[i][dID] = strval(field);
mysql_fetch_field_row(field, "Model"); DealerInfo[i][Model] = strval(field);
mysql_fetch_field_row(field, "PosX"); DealerInfo[i][PosX] = floatstr(field);
mysql_fetch_field_row(field, "PosY"); DealerInfo[i][PosY] = floatstr(field);
mysql_fetch_field_row(field, "PosZ"); DealerInfo[i][PosZ] = floatstr(field);
mysql_fetch_field_row(field, "Color1"); DealerInfo[i][Ccolor1] = strval(field);
mysql_fetch_field_row(field, "Color2"); DealerInfo[i][Ccolor2] = strval(field);
mysql_fetch_field_row(field, "Angle"); DealerInfo[i][Aangle] = strval(field);
mysql_fetch_field_row(field, "Cost");DealerInfo[i][Cost] = strval(field);
DealerInfo[i][Car] = CreateVehicle(DealerInfo[i][Model],DealerInfo[i][PosX],DealerInfo[i][PosY],DealerInfo[i][PosZ],DealerInfo[i][Aangle],DealerInfo[i][Ccolor1],DealerInfo[i][Ccolor2],60);
format(str,sizeof(str),"{FF9900}Car ID:{FFFFFF} %d\n{FF9900}Cost:{FFFFFF} %d",DealerInfo[i][dID],DealerInfo[i][Cost]);
DealerInfo[i][dlabel] = Create3DTextLabel(str,-1,DealerInfo[i][PosX],DealerInfo[i][PosY],DealerInfo[i][PosZ],100,-1,0);
Attach3DTextLabelToVehicle(DealerInfo[i][dlabel],DealerInfo[i][Car],0,0,0);
mysql_free_result();
}
}
return printf("%d dealership cars loaded",barcount);
}
Re: why wont the vehicle load? -
Tanush123 - 18.03.2012
pawn Код:
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17229) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17229) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17230) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17230) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17231) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17231) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17232) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17232) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17233) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17233) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17234) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17234) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17235) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17235) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17236) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17236) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17237) : error 048: array dimensions do not match
D:\Users\Tanush\Desktop\Xtreme Gaming\gamemodes\server.pwn(17237) : error 048: array dimensions do not match
Re: why wont the vehicle load? -
Shabi RoxX - 18.03.2012
field must be a STRING;
Re: why wont the vehicle load? -
Tanush123 - 18.03.2012
lol my field is like this
All the dynamic things i created uses field and dealership is the only thing that has a problem
Re: why wont the vehicle load? -
Shabi RoxX - 18.03.2012
What field[128][128] Fuck

128 is too much for array and also for your mysql data I think
Re: why wont the vehicle load? -
Tanush123 - 18.03.2012
Well i use field[128][128] and it works perfect with my register login,dynamic orgs,dynamic jobs,dynamic house and etc. What seems to be the problem for the vehicle because it won't spawn while it saved correct on my phpmyadmin
Re: why wont the vehicle load? -
Shabi RoxX - 18.03.2012
So What it print for you on your system ?
pawn Код:
return printf("%d dealership cars loaded",barcount);// ????