#Michael_Walker
Умник
PHP:
public OnGameModeInit()
{
new string[64];
mysql_format(connect_mysql, string, sizeof(string), "SELECT * FROM `accounts` WHERE `Car` = '0'");
mysql_tquery(connect_mysql, string, "LoadPlayerCars");
return true;
}
PHP:
publics LoadPlayerCars()
{
new rows = cache_num_rows(), name[24], newcarid, vehicleid, Float:pos[4], color[2], string[100];
for(new i; i < rows; i++)
{
cache_get_field_content(i, "Name", name, connect_mysql, 32);
vehicleid = cache_get_field_content_int(i, "Car");
color[0] = cache_get_field_content_int(i, "Color1");
color[1] = cache_get_field_content_int(i, "Color2");
pos[0] = cache_get_field_content_float(i, "PosX");
pos[1] = cache_get_field_content_float(i, "PosY");
pos[2] = cache_get_field_content_float(i, "PosZ");
pos[3] = cache_get_field_content_float(i, "PosA");
newcarid = AddStaticVehicleEx(vehicleid, pos[0], pos[1], pos[2], pos[3], color[0], color[1], 86400, 0);
Vehicle[newcarid][vMileage] = cache_get_field_content_float(i, "Mileage");
Vehicle[newcarid][vFuel] = cache_get_field_content_float(i, "Fuel");
mysql_format(connect_mysql, string, sizeof(string), "UPDATE `accounts` SET `caridserver` = '%d', WHERE `Name` = '%s'", newcarid, name);
mysql_tquery(connect_mysql, string);
Vehicle[newcarid][vLock] = true;
}
return true;
}
