-
Автор темы
- #1
ЧЕ это такое?
Эт вот такой луч. Прям как траектория в ските да да...
Указатель который возвращает
Материал нужно прекешить.
Эт вот такой луч. Прям как траектория в ските да да...
LUA:
ffi.cdef([[
typedef struct {
float x;
float y;
float z;
} s_vector;
typedef struct {
int type;
void* start_entity;
int start_attachment;
void* end_entity;
int end_attachment;
s_vector start;
s_vector ehd;
int model_index;
const char* model_name;
int halo_index;
const char* halo_name;
float halo_scale;
float duration;
float width;
float end_width;
float fade_length;
float amplitude;
float brightness;
float speed;
int start_frame;
float frame_rate;
float red;
float green;
float blue;
bool renderable;
int segments;
int flags;
s_vector center;
float start_radius;
float end_radius;
} s_beam_info;
typedef struct {
char pad_0[12];
s_vector mins;
s_vector maxs;
char pad_1[8];
void* next;
int type;
int flags;
int attachment_count;
s_vector attachment[10];
s_vector delta;
char pad_2[8];
float die_at;
float width;
float end_width;
float fade_length;
float amplitude;
float duration;
float red;
float green;
float blue;
float brightness;
float speed;
float frame_rate;
float frame;
int segments;
unsigned int entity[10];
int made_by_ru_paste[10];
int model_index;
int halo_index;
float halo_scale;
int frame_count;
float rg_noise[129];
void* trail;
float start_radius;
float end_radius;
char pad_3[5];
} s_beam;
]])
local spline = {} do
spline.beam_class = ffi.cast("void*[B]", ffi.cast("void[/B]", ffi.cast("char*", utils.opcode_scan("client.dll", "B9 ? ? ? ? A1 ? ? ? ? FF 10 A1 ? ? ? ? B9")) + 1)[0])--....
spline.beam_create = ffi.cast("s_beam*(__thiscall*)(void*, s_beam_info*)", spline.beam_class[0][12])
spline.create = function(points, material, width, rgba)
if #points < 2 then
return
end
local beam_info = ffi.new("s_beam_info")
beam_info.type = 6
beam_info.start = {points[1]:unpack()}
beam_info.ehd = {points[2]:unpack()}
beam_info.model_index = -1
beam_info.model_name = material
beam_info.halo_scale = 0
beam_info.duration = 0
beam_info.width = width
beam_info.end_width = width
beam_info.fade_length = 0
beam_info.amplitude = 0
beam_info.brightness = rgba.a
beam_info.speed = 0
beam_info.start_frame = 0
beam_info.frame_rate = 0
beam_info.red = rgba.r
beam_info.green = rgba.g
beam_info.blue = rgba.b
beam_info.renderable = true
beam_info.segments = -1
beam_info.flags = 16643
local spline = spline.beam_create(spline.beam_class, beam_info)
if spline ~= nil then
spline.attachment_count = math.min(#points, 10)
for i = 2, spline.attachment_count do
spline.attachment[i - 1] = {points[i]:unpack()}
end
return spline
end
end
spline.remove = function(spline)
if spline ~= nil then
spline.flags = 0
spline.die_at = globals.curtime
end
end
end
Использование:
spline.create(points: table, material: string, width: number, rgba: color): s_beam*
spline.remove(spline: s_beam*)
После создания он будет отображаться до тех пор, пока не будет удален.Ограничения:
spline.create: #points >= 2 and points[1]:dist(points[2]) >= 0.1
Точек может быть не более 10, остальные будут проигнорированы
Указатель который возвращает
spline.create
нужно сохранять. Проебал указатель, ждёшь смены карты.Материал нужно прекешить.