public OnFilterScriptInit()
{
mysql_log(LOG_ALL);
print("\n--------------------------------------");
print(" ************************************");
print("--------------------------------------\n");
dbconnect(SQL_DB);
return 1;
}
forward dbconnect(db);
public dbconnect(db) {
if(db == SQL_DB) {
dbHandle = mysql_connect(MySQL_HOST, MySQL_USER, MySQL_DATABASE, MySQL_PASSWORD);
if(mysql_errno() != 0) {
print("Failed connection to database -- Shutting down.");
SendRconCommand("exit");
}
else
{
print("Successful connection to database -- Continue ~~~");
}
LoadDSquery();
}
}
stock LoadDSquery() {
mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "LoadDEALERSHIPS");
return 1;
}
forward loadDEALERSHIPS();
public loadDEALERSHIPS() {
for(new i = 0 ; i < cache_num_rows(dbHandle) ; i++) {
DS[i][DsID] = cache_get_field_content_int(i, "DsID", dbHandle);
DS[i][DsLocX] = cache_get_field_content_float(i, "DsLocX", dbHandle);
DS[i][DsLocY] = cache_get_field_content_float(i, "DsLocY", dbHandle);
DS[i][DsLocZ] = cache_get_field_content_float(i, "DsLocZ", dbHandle);
DS[i][DsIcon] = cache_get_field_content_int(i, "DsIcon", dbHandle);
DS[i][DsSpawned] = cache_get_field_content_int(i, "DsSpawned", dbHandle);
DsPickups = CreatePickup(1239, 23, DS[i][DsLocX], DS[i][DsLocY], DS[i][DsLocZ], -1);
DS[i][DsSpawned] = 1;
}
printf("Loaded %d DEALERSHIPS", cache_num_rows(dbHandle));
return 1;
}
mysql_tquery(dbHandle, "SELECT * FROM `dealerships`", "LoadDEALERSHIPS", ""); // Added the extra ,""
You mentioned LoadDEALERSHIPS on calling the thread and while forwarding it, it got changed to loadDEALERSHIPS .
|
Try this:
pawn Код:
|