24.03.2011, 20:41
Ok, i have 2 mysql based stocks origianlly coded in Gstyles, but i switched to strikenkids for better speed and stableness.
When i switched, alot of things had to change but i fixed them, but i did everythign i know how to these and nothing works.
Can someone help me get them working again?
This stock is supposed to load vehicle form a mysql db.
This stock is supposed to load 3dTexts and Pickups from a mysql db.
When i switched, alot of things had to change but i fixed them, but i did everythign i know how to these and nothing works.
Can someone help me get them working again?
This stock is supposed to load vehicle form a mysql db.
pawn Код:
stock LoadOwnedVehicles()
{
new
String[512],
ModelL,
CL[2],
PriceL,
OwnerL[MAX_PLAYER_NAME],
Float:PosL[4],
ID,
PlateNumL[32];
mysql_query("SELECT * FROM `ownedcars` WHERE `ID`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(String))
{
sscanf(String,"p<|>iiiiis[24]ffffs[32]", ID, ModelL, CL[0], CL[1], PriceL, OwnerL, PosL[0], PosL[1], PosL[2], PosL[3], PlateNumL);//1695
vehicledata[ID][Model] = ModelL;
vehicledata[ID][Color1] = CL[0];
vehicledata[ID][Color2] = CL[1];
vehicledata[ID][Price] = PriceL;
format(vehicledata[ID][Owner], 24, "%s", OwnerL);
vehicledata[ID][PosX] = PosL[0];
vehicledata[ID][PosY] = PosL[1];
vehicledata[ID][PosZ] = PosL[2];
vehicledata[ID][PosA] = PosL[3];
format(vehicledata[ID][Plate], 32, "%s", PlateNumL);
new
ownedcar = CreateVehicle(ModelL, PosL[0], PosL[1], PosL[2], PosL[3], CL[0], CL[1], 500000);//1708
SetVehicleNumberPlate(ownedcar, PlateNumL);
isowned[ID] = ownedcar;
printf("Owned vehicle %d spawned!",ID);
}
}
mysql_free_result();
return 1;
}
pawn Код:
stock AddStoreFromMysql()
{
new Str[67], Float:X, Float:Y, Float:Z, STotal;
mysql_query("SELECT * FROM `stores`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
while(mysql_fetch_row(Str))
{
sscanf(Str, "p<|>fff", X, Y, Z);
StorePickup = CreateDynamicPickup(1274, 23, X, Y, Z, -1, -1, -1, PICKUPDISTANCE);
CreateDynamic3DTextLabel("Store", COLOR_YELLOW, X, Y, Z, 100.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, TEXTLABELDISTANCE);
CreateDynamicMapIcon(X, Y, Z, 38, 0, -1, -1, -1, MAPICONDISTANCE);
STotal++;
}
}
mysql_free_result();
printf("** %i\t<->\tStores Loaded From\t<->\tMySQL\t\t **", STotal);
return 1;
}