Код:
public LoadDynamicGates()
{
new rows, fields;
new total = 0;
new object, id, model, faction, Float:speed, Float:movex, Float:movey, Float:movez, Float:moverx, Float:movery, Float:moverz, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, interior, world, name[256];
new sound, soundlength;
cache_get_data(rows, fields);
if(rows)
{
while(total < rows)
{
id = cache_get_row_int(total, 0),
model = cache_get_row_int(total, 1),
faction = cache_get_row_int(total, 2),
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),
speed = cache_get_row_float(total, 9),
movex = cache_get_row_float(total, 10),
movey = cache_get_row_float(total, 11),
movez = cache_get_row_float(total, 12),
moverx = cache_get_row_float(total, 13),
movery = cache_get_row_float(total, 14),
moverz = cache_get_row_float(total, 15),
interior = cache_get_row_int(total, 16),
world = cache_get_row_int(total, 17),
cache_get_row(total, 18, name, dbHandle, 128),
sound = cache_get_row_int(total, 19),
soundlength = cache_get_row_int(total, 20);
object = CreateDynamicObject(model, x, y, z, rx, ry, rz, world, -1, -1, 200.0);
Gates[object][gateID] = id;
Gates[object][gateModel] = model;
Gates[object][gateFaction] = faction;
Gates[object][gatePosX] = x;
Gates[object][gatePosY] = y;
Gates[object][gatePosZ] = z;
Gates[object][gatePosRX] = rx;
Gates[object][gatePosRY] = ry;
Gates[object][gatePosRZ] = rz;
Gates[object][gateOpenSpeed] = speed;
Gates[object][gateMoveX] = movex;
Gates[object][gateMoveY] = movey;
Gates[object][gateMoveZ] = movez;
Gates[object][gateMoveRX] = moverx;
Gates[object][gateMoveRY] = movery;
Gates[object][gateMoveRZ] = moverz;
Gates[object][gateInterior] = interior;
Gates[object][gateVirtualWorld] = world;
Gates[object][gateSound] = sound;
Gates[object][gateSoundLength] = soundlength;
format(Gates[object][gateName], 256, "%s", name);
Gates[object][gateObjectOn] = 1;
Gates[object][gateObject] = object;
total++;
}
}
format(msg,sizeof(msg), "Loaded %d dynamic gates from MySQL.", total);
printf(msg);
return 1;
}