- 1,047
- 478
Есть какой-нибудь аналог GetTickCount64() на Linux?
asm-linux/src/gettickcount.c at master · Killswitch00/asm-linux
Arma Server Monitor for Linux. Contribute to Killswitch00/asm-linux development by creating an account on GitHub.
Есть какой-нибудь аналог GetTickCount64() на Linux?
Возвращаемое значение - 4 байта, мне 8 нужно![]()
asm-linux/src/gettickcount.c at master · Killswitch00/asm-linux
Arma Server Monitor for Linux. Contribute to Killswitch00/asm-linux development by creating an account on GitHub.github.com
Возвращаемое значение - 4 байта, мне 8 нужно
#include <cstdint>
#include <ctime>
std::uint64_t GetTickCount64(void)
{
timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
return (std::uint64_t)ts.tv_sec * 1000 + (std::uint64_t)ts.tv_nsec / 1000000;
}
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <d3d9.h>
#include <d3dx9.h>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include "imgui/imgui.h"
#include "imgui/examples/imgui_impl_win32.h"
#include "imgui/examples/imgui_impl_dx9.h"
#pragma comment(lib, "d3d9.lib")
#pragma comment(lib, "d3dx9.lib")
Используй конвертер d3d8to9 и работай уже с d3d9))Как вообще можно работать с рендером D3D8? В Direct SDK нет ничего связаного с D3D8 Где каким-то чудестным методом можно взять d3d8.h, d3dx8.h?
[21:53:28.481123] (error) test.lua: error loading module 'library' from file 'D:\gta\moonloader\lib\library.dll':
Не найден указанный модуль.
stack traceback:
[C]: in ?
[C]: in function 'require'
D:\gta\moonloader\test.lua:4: in main chunk
как имитировать нажатие шифта7
Winapi хукайКак заблокировать нажатие клавиши7
string CambiarColor = "{0000FF}";
}
if (!pshow < 201 && pi == true && autocolor == true)
{
sprintf(pall, "%s %d", CambiarColor, pshow);
libcurl + хук самп-клиентовских функцийКак я могу сделать то же самое, но на C++? (Я просто хочу научиться отправлять данные в дискорд)) (.asi — .sf)
Lua:local encoding = require 'encoding' -- подключаем для корректной отправки русских букв encoding.default = 'CP1251' u8 = encoding.UTF8 local sampev = require 'lib.samp.events' -- подключаем для хука отправки ответа на диалог local effil = require 'effil' -- для ассинхронных запросов local url = 'URL' local data = { ['content'] = '', -- текст (меняется через команду, так что можно оставить пустым) ['username'] = 'Sended from .lua script!', -- ник отправителя ['avatar_url'] = 'https://c.tenor.com/Z9mXH7-MlcsAAAAS/sexy-black-man-thirst-trap.gif', -- ссылка на аватарку (можно убрать, будет дефолтная) ['tts'] = false, -- tts - text to speech - читалка сообщений (true/false) -- так же можно сделать еще много чего, подробнее тут: https://discord.com/developers/docs/resources/webhook } function main() while not isSampAvailable() do wait(0) end sampRegisterChatCommand('ds.msg', function(arg) data['username'] = sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) -- ник отправителя = ник в игре data['content'] = arg -- делаем что бы текст сообщения был равен тексту который мы ввели после команды -- отправляем запрос asyncHttpRequest('POST', url, {headers = {['content-type'] = 'application/json'}, data = u8(encodeJson(data))}, function(response) print('[WebHook] [OK] отправлено!') end, function(err) print('[WebHook] [ERROR] error: '..err) end) end) wait(-1) end -- функция для отправки ассинхронных сообщений function asyncHttpRequest(method, url, args, resolve, reject) local request_thread = effil.thread(function (method, url, args) local requests = require 'requests' local result, response = pcall(requests.request, method, url, args) if result then response.json, response.xml = nil, nil return true, response else return false, response end end)(method, url, args) -- Если запрос без функций обработки ответа и ошибок. if not resolve then resolve = function() end end if not reject then reject = function() end end -- Проверка выполнения потока lua_thread.create(function() local runner = request_thread while true do local status, err = runner:status() if not err then if status == 'completed' then local result, response = runner:get() if result then resolve(response) else reject(response) end return elseif status == 'canceled' then return reject(status) end else return reject(err) end wait(0) end end) end
Try passing sprintf not std::string, but const char* -> CambiarColor.c_str()Why does the string "CambiarColor" not work for me?
I mean, in the sprintf the text is not shown
I have the "CambiarColor" stored as char
C++:string CambiarColor = "{0000FF}"; } if (!pshow < 201 && pi == true && autocolor == true) { sprintf(pall, "%s %d", CambiarColor, pshow);
It gives me this error.Try passing sprintf not std::string, but const char* -> CambiarColor.c_str()
CambiarColor.c_str() = Error (active) E0153 The expression must have a class type, but it has the type "char