#define MAX_WORK_VEHICLES 10
enum wAndmed
{
wT88ID,
wMasinaID,
wT88MasinaID,
wModelID,
wTyyp[36],
Float: wPosX,
Float: wPosY,
Float: wPosZ,
Float: wAngle,
wV2rv1,
wV2rv2
}
new T88MasinateInfo[MAX_WORK_VEHICLES][wAndmed];
forward LoadWorkVehicles();
public LoadWorkVehicles()
{
new rows, fields, string[256], number[11];
cache_get_data(rows, fields);
if(!rows)
{
print("Tцц Masinad = Tьhi.");
return 1;
}
else
{
new i = 1;
while(i < MAX_WORK_VEHICLES)
{
cache_get_row(0, 0, number), T88MasinateInfo[i][wT88ID] = strval(number);
cache_get_row(0, 1, number), T88MasinateInfo[i][wMasinaID] = strval(number);
cache_get_row(0, 2, number), T88MasinateInfo[i][wT88MasinaID] = strval(number);
cache_get_row(0, 3, number), T88MasinateInfo[i][wModelID] = strval(number);
cache_get_row(0, 4, string); format(T88MasinateInfo[i][wTyyp], 36, "%s", string);
cache_get_row(0, 5, number), T88MasinateInfo[i][wPosX] = floatstr(number);
cache_get_row(0, 6, number), T88MasinateInfo[i][wPosY] = floatstr(number);
cache_get_row(0, 7, number), T88MasinateInfo[i][wPosZ] = floatstr(number);
cache_get_row(0, 8, number), T88MasinateInfo[i][wAngle] = floatstr(number);
cache_get_row(0, 9, number), T88MasinateInfo[i][wV2rv1] = strval(number);
cache_get_row(0, 10, number), T88MasinateInfo[i][wV2rv2] = strval(number);
printf("%d", i);
if(T88MasinateInfo[i][wT88MasinaID])
{
T88MasinateInfo[i][wMasinaID] = CreateVehicle(T88MasinateInfo[i][wModelID], T88MasinateInfo[i][wPosX], T88MasinateInfo[i][wPosY], T88MasinateInfo[i][wPosZ], T88MasinateInfo[i][wAngle], T88MasinateInfo[i][wV2rv1], T88MasinateInfo[i][wV2rv2], 2);
printf("Masinad ID: %d", T88MasinateInfo[i][wMasinaID]);
}
i++;
}
print("Tцц Masinad = Laetud.");
}
return 1;
}
forward OnGameModeInitMysqlLoad();
public OnGameModeInitMysqlLoad()
{
new query[500];
format(query, sizeof(query), "SELECT * FROM tццmasinad");
mysql_function_query(SQL, query, true, "LoadWorkVehicles", "");
return 1;
}
else
{
for(new i; i != rows; i++)
{
cache_get_row(i, 0, number), T88MasinateInfo[i][wT88ID] = strval(number);
cache_get_row(i, 1, number), T88MasinateInfo[i][wMasinaID] = strval(number);
cache_get_row(i, 2, number), T88MasinateInfo[i][wT88MasinaID] = strval(number);
cache_get_row(i, 3, number), T88MasinateInfo[i][wModelID] = strval(number);
cache_get_row(i, 4, string); format(T88MasinateInfo[i][wTyyp], 36, "%s", string);
cache_get_row(i, 5, number), T88MasinateInfo[i][wPosX] = floatstr(number);
cache_get_row(i, 6, number), T88MasinateInfo[i][wPosY] = floatstr(number);
cache_get_row(i, 7, number), T88MasinateInfo[i][wPosZ] = floatstr(number);
cache_get_row(i, 8, number), T88MasinateInfo[i][wAngle] = floatstr(number);
cache_get_row(i, 9, number), T88MasinateInfo[i][wV2rv1] = strval(number);
cache_get_row(i, 10, number), T88MasinateInfo[i][wV2rv2] = strval(number);
printf("%d", i);
if(T88MasinateInfo[i][wT88MasinaID])
{
T88MasinateInfo[i][wMasinaID] = CreateVehicle(T88MasinateInfo[i][wModelID], T88MasinateInfo[i][wPosX], T88MasinateInfo[i][wPosY], T88MasinateInfo[i][wPosZ], T88MasinateInfo[i][wAngle], T88MasinateInfo[i][wV2rv1], T88MasinateInfo[i][wV2rv2], 2);
printf("Masinad ID: %d", T88MasinateInfo[i][wMasinaID]);
}
}
print("Tцц Masinad = Laetud.");
}
Sice you're using MySQL you want to make i = 1 so it links to the Database entry id and make it easy for any 'Admin' systems to work, not 0.
|