28.08.2015, 20:54
(
Последний раз редактировалось Logofero; 28.08.2015 в 21:18.
Причина: Fixed
)
Optimization and fix:
PHP код:
enum MOVEABLE_DOORS
{
doorID,
doorModel,
doorObject,
doorName[256],
doorInterior,
doorVirtualWorld,
doorFaction,
doorOpened,
Float:doorPosX,
Float:doorPosY,
Float:doorPosZ,
Float:doorPosRX,
Float:doorPosRY,
Float:doorPosRZ,
Float:doorOpenSpeed,
Float:doorMoveX,
Float:doorMoveY,
Float:doorMoveZ,
doorObjectOn
}
new Doors[MAX_OBJECTS][MOVEABLE_DOORS];
public LoadDynamicCCTV()
{
new
rows,
fields,
total = 0,
object,
world,
Float:x, Float:y, Float:z,
Float:rx, Float:ry, Float:rz
;
cache_get_data(rows, fields);
if(rows) {
while(total < rows) {
x = cache_get_row_float(total, 2);
y = cache_get_row_float(total, 3);
z = cache_get_row_float(total, 4);
rx = cache_get_row_float(total, 5);
ry = cache_get_row_float(total, 6);
rz = cache_get_row_float(total, 7);
world = cache_get_row_int(total, 9);
object = CreateDynamicObject(1886, x, y, z, rx, ry, rz, -1, -1, -1, 200.0);
CCTVInfo[object][tvPosX] = x;
CCTVInfo[object][tvPosY] = y;
CCTVInfo[object][tvPosZ] = z;
CCTVInfo[object][tvPosRX] = rx;
CCTVInfo[object][tvPosRY] = ry;
CCTVInfo[object][tvPosRZ] = rz;
CCTVInfo[object][tvVirtualWorld] = world;
CCTVInfo[object][tvID] = cache_get_row_int(total, 0);
CCTVInfo[object][tvFaction] = cache_get_row_int(total, 1);
CCTVInfo[object][tvInterior] = cache_get_row_int(total, 8);
cache_get_row(total, 10, CCTVInfo[object][tvName], dbHandle, 256);
CCTVInfo[object][tvObjectOn] = 1;
CCTVInfo[object][tvObject] = object;
total++;
}
}
format(msg,sizeof(msg), "Loaded %d dynamic CCTV's from MySQL.", total);
printf(msg);
return 1;
}
public LoadMoveDoors()
{
new
rows,
fields,
total = 0,
object,
world,
Float:x, Float:y, Float:z,
Float:rx, Float:ry, Float:rz
;
cache_get_data(rows, fields);
if(rows) {
while(total < rows) {
x = cache_get_row_float(total, 3);
y = cache_get_row_float(total, 4);
z = cache_get_row_float(total, 5);
rx = cache_get_row_float(total, 6);
ry = cache_get_row_float(total, 7);
rz = cache_get_row_float(total, 8);
world = cache_get_row_int(total, 10);
object = CreateDynamicObject(model, x, y, z, rx, ry, rz, world, -1, -1, 200.0);
Doors[object][doorPosX] = x;
Doors[object][doorPosY] = y;
Doors[object][doorPosZ] = z;
Doors[object][doorPosRX] = rx;
Doors[object][doorPosRY] = ry;
Doors[object][doorPosRZ] = rz;
Doors[object][doorVirtualWorld] = world;
Doors[object][doorID] = cache_get_row_int(total, 0);
Doors[object][doorModel] = cache_get_row_int(total, 1);
Doors[object][doorFaction] = cache_get_row_int(total, 2);
Doors[object][doorPosX] = cache_get_row_float(total, 3);
Doors[object][doorPosY] = cache_get_row_float(total, 4);
Doors[object][doorPosZ] = cache_get_row_float(total, 5);
Doors[object][doorPosRX] = cache_get_row_float(total, 6);
Doors[object][doorPosRY] = cache_get_row_float(total, 7);
Doors[object][doorPosRZ] = cache_get_row_float(total, 8);
Doors[object][doorInterior] = cache_get_row_int(total, 9); // Why ID 8? Fixed.
cache_get_row(total, 11, Doors[object][doorName], dbHandle, 256),
Doors[object][doorOpenSpeed] = cache_get_row_float(total, 12);
Doors[object][doorMoveX] = cache_get_row_float(total, 13);
Doors[object][doorMoveY] = cache_get_row_float(total, 14);
Doors[object][doorMoveZ] = cache_get_row_float(total, 15);
Doors[object][doorObjectOn] = 1;
Doors[object][doorObject] = object;
total++;
}
}
format(msg,sizeof(msg), "Loaded %d dynamic movable doors from MySQL.", total);
printf(msg);
return 1;
}