SA:MP Dedicated Server ---------------------- v0.2.2, ©2005-2007 SA:MP Team [13:37] [13:37] Server Plugins [13:37] -------------- [13:37] Loading plugin: mysql [13:37] > MySQL plugin R3 successfully loaded. [13:37] Loaded. [13:37] Loading plugin: sampmysql [13:37] /*************************************************/ /* SAMP-MySQL v0.15 Plugin loaded successfully ! */ /*************************************************/ [13:37] Loaded. [13:37] Loaded 2 plugins. [13:37] [13:37] Filter Scripts [13:37] --------------- [13:37] Loading filter script 'adminspec.amx'... [13:37] Loading filter script 'vactions.amx'... [13:37] Loading filter script 'Untitled.amx'... [13:37] Loaded 3 filter scripts. [13:37] MYSQL: Attempting to connect to server... [13:37] Connection to MySQL database: Successfull ! [13:37] MYSQL: Database connection established.
|
Originally Posted by ray187
What`s the next mysql related call you do in OnGameModeInit?
|
MySQLConnect(MYSQL_HOST,MYSQL_USER,MYSQL_PASS,MYSQL_DB);
LoadSQLCars();
printf("Loading families...");
LoadSQLFamilies();
printf("LoadSQLFamilyGates()");
LoadSQLFamilyGates();
printf("LoadSQLObjects()");
LoadSQLObjects();
printf("LoadSQLBizz()");
LoadSQLBizz();
printf("LoadSQLSBizz()");
LoadSQLSBizz();
printf("LoadSQLProperty()");
LoadSQLProperty();
printf("LoadSQLApartments()");
LoadSQLApartments();
printf("LoadSQLSpamWords()");
LoadSQLSpamWords();
printf("LoadSQLGPS()");
LoadSQLGPS();
new string[MAX_PLAYER_NAME];
new string1[MAX_PLAYER_NAME];
/-[ Load cars from SQL database ]----------------------------------------------------------------------
public LoadSQLCars() {
MySQLCheckConnection();
new sql[64], fields[25][40], row[255];
new Float:park_x, Float:park_y, Float:park_z, Float:park_a;
// new owner[MAX_PLAYER_NAME];
format(sql, sizeof(sql), "SELECT COUNT(*) FROM cars");
samp_mysql_query(sql);
//if (DEBUG) SQLLog(sql);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
totalcars = strval(row);
for (new i=1; i<=totalcars; i++)
{
format(sql, sizeof(sql), "SELECT * FROM cars WHERE id=%d", i);
samp_mysql_query(sql);
//if (DEBUG) SQLLog(sql);
samp_mysql_store_result();
samp_mysql_fetch_row(row);
split(row, fields, '|');
// carid = strval(fields[0]);
CarInfo[i][cModel] = strval(fields[1]);
CarInfo[i][cLocationx] = floatstr(fields[2]);
CarInfo[i][cLocationy] = floatstr(fields[3]);
CarInfo[i][cLocationz] = floatstr(fields[4]);
CarInfo[i][cAngle] = floatstr(fields[5]);
park_x = floatstr(fields[6]);
park_y = floatstr(fields[7]);
park_z = floatstr(fields[8]);
park_a = floatstr(fields[9]);
if (park_x != 0 && park_y != 0 && park_z != 0)
{
CarInfo[i][cLocationx] = park_x;
CarInfo[i][cLocationy] = park_y;
CarInfo[i][cLocationz] = park_z;
CarInfo[i][cAngle] = park_a;
}
CarInfo[i][cColorOne] = strval(fields[10]);
CarInfo[i][cColorTwo] = strval(fields[11]);
CarInfo[i][cOwned] = strval(fields[12]);
memcpy(CarInfo[i][cOwner], fields[13], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
memcpy(CarInfo[i][cDescription], fields[17], 0, MAX_PLAYER_NAME*4, MAX_PLAYER_NAME*4);
CarInfo[i][cValue] = strval(fields[18]);
CarInfo[i][cFamily] = strval(fields[15]);
CarInfo[i][cFaction] = strval(fields[14]);
CarInfo[i][cType] = strval(fields[16]);
CarInfo[i][cRespawnable] = strval(fields[19]);
CarInfo[i][cRespawnTime] = 0;
CarInfo[i][cLock] = strval(fields[20]); // Locked
CarInfo[i][cHouse] = strval(fields[22]);
if (carsreloaded==0) AddStaticVehicleEx(CarInfo[i][cModel], CarInfo[i][cLocationx], CarInfo[i][cLocationy], CarInfo[i][cLocationz]+0.25, CarInfo[i][cAngle], CarInfo[i][cColorOne], CarInfo[i][cColorTwo], CarInfo[i][cValue]);
else CarRespawn(i);
// printf("Car: %d, Model: %d, Owner: %s, Type: %d, Desc: %s", i, CarInfo[i][cModel], CarInfo[i][cOwner], CarInfo[i][cType], CarInfo[i][cDescription]);
}
carsreloaded++;
format(row, sizeof(row), "LoadSQLCars(): %d cars loaded", totalcars);
printf(row);
}