
08.03.2023, 07:18
|
|
Участник форума
Регистрация: 27.05.2021
Сообщений: 140
С нами:
2614229
Репутация:
33
|
|
Can someone help me rewrite these .lua snippets in C++? I tried it on my own but it didn't work
Lua:
Код:
if
move
==
true
then
cursor
(
)
repeat
wait
(
0
)
cursorx
,
cursory
=
getCursorPos
(
)
sampToggleCursor
(
1
)
Ini
.
cfg
.
x
=
cursorx
Ini
.
cfg
.
y
=
cursory
if
isKeyDown
(
27
)
then
move
=
0
end
until
isKeyDown
(
32
)
sampToggleCursor
(
0
)
sampSetCursorMode
(
0
)
move
=
false
Ini
.
cfg
.
x
=
cursorx
Ini
.
cfg
.
y
=
cursory
inicfg
.
save
(
Ini
,
MyIni
)
end
Lua:
Код:
function
cursor
(
)
local
x
,
y
=
getScreenResolution
(
)
local
x
=
x
/
2
local
y
=
x
/
2
-- local x = x - 100
local
y
=
y
-
-
70
local
result
,
lib
=
loadDynamicLibrary
(
"user32.dll"
)
if
result
then
local
result
,
proc
=
getDynamicLibraryProcedure
(
"SetCursorPos"
,
lib
)
local
a
=
callFunction
(
proc
,
2
,
0
,
x
,
y
)
freeDynamicLibrary
(
lib
)
end
end
|
|
|

17.03.2023, 12:03
|
|
Новичок
Регистрация: 17.03.2023
Сообщений: 8
С нами:
1665045
Репутация:
3
|
|
Сообщение от !Sam#0235
Can someone help me rewrite these .lua snippets in C++? I tried it on my own but it didn't work
Lua:
Код:
if
move
==
true
then
cursor
(
)
repeat
wait
(
0
)
cursorx
,
cursory
=
getCursorPos
(
)
sampToggleCursor
(
1
)
Ini
.
cfg
.
x
=
cursorx
Ini
.
cfg
.
y
=
cursory
if
isKeyDown
(
27
)
then
move
=
0
end
until
isKeyDown
(
32
)
sampToggleCursor
(
0
)
sampSetCursorMode
(
0
)
move
=
false
Ini
.
cfg
.
x
=
cursorx
Ini
.
cfg
.
y
=
cursory
inicfg
.
save
(
Ini
,
MyIni
)
end
Lua:
Код:
function
cursor
(
)
local
x
,
y
=
getScreenResolution
(
)
local
x
=
x
/
2
local
y
=
x
/
2
-- local x = x - 100
local
y
=
y
-
-
70
local
result
,
lib
=
loadDynamicLibrary
(
"user32.dll"
)
if
result
then
local
result
,
proc
=
getDynamicLibraryProcedure
(
"SetCursorPos"
,
lib
)
local
a
=
callFunction
(
proc
,
2
,
0
,
x
,
y
)
freeDynamicLibrary
(
lib
)
end
end
sure.
1.
C++:
Код:
#include "inicfg.h"
ImVec4
color
(
mainIni
.
color
.
R
/
255.0f
,
mainIni
.
color
.
G
/
255.0f
,
mainIni
.
color
.
B
/
255.0f
,
1.0f
)
;
if
(
ImGui
::
ColorEdit4
(
"Color"
,
&
color
.
x
)
)
{
int
clr
=
join_argb
(
0
,
color
.
x
*
255
,
color
.
y
*
255
,
color
.
z
*
255
,
color
.
w
*
255
)
;
int
r
=
color
.
x
*
255
,
g
=
color
.
y
*
255
,
b
=
color
.
z
*
255
,
a
=
color
.
w
*
255
;
mainIni
.
config
.
hex
=
(
"%06X"
)
.
format
(
clr
)
;
mainIni
.
color
.
R
=
r
;
mainIni
.
color
.
G
=
g
;
mainIni
.
color
.
B
=
b
;
inicfg
::
save
(
mainIni
,
directIni
)
;
}
2.
C++:
Код:
#include
void
cursor
(
)
{
int
x
=
GetSystemMetrics
(
SM_CXSCREEN
)
/
2
;
int
y
=
GetSystemMetrics
(
SM_CYSCREEN
)
/
2
;
// x = x - 100; // uncomment this line if you want to move the cursor to the left by 100px
y
=
y
+
70
;
// moves the cursor 70 pixels down
SetCursorPos
(
x
,
y
)
;
// set the cursor to a new position
}
p.s
In this code, we use the GetSystemMetrics WinAPI function to get the screen resolution, and then use the SetCursorPos function to move the cursor to the specified location. By default, the cursor will be shifted 70 pixels down. If you want to move the cursor to the left by 100 pixels, then uncomment the line x = x - 100;.
|
|
|

11.03.2023, 17:21
|
|
Познающий
Регистрация: 12.08.2022
Сообщений: 59
С нами:
1976847
Репутация:
18
|
|
нужна помощь, не понимаю как параметры ввести юзеру.
так бы на луа выглядило:
lua:
Код:
sampRegisterChatCommand
(
'cmd'
,
function
(
arg
)
if
arg
:
match
(
'%d+:%d+:%d+:%d+'
)
then
a
,
b
.
c
.
e
=
arg
:
match
(
'(%d+):(%d+):(%d+):(%d+)'
)
else
sampAddChatMessage
(
'invalid parameters'
,
-
1
)
end
end
)
а на плюсах я делаю что то типо:
cpp(sf):
Код:
SF
->
getSAMP
(
)
->
registerChatCommand
(
"cmd"
,
[
]
(
std
::
string param
)
{
SF
->
getSAMP
(
)
->
getChat
(
)
->
AddChatMessage
(
-
1
,
"param: %s"
,
param
.
c_str
(
)
)
;
}
)
;
Но как юзеру вводить 4 аргумента, а так же проверять, верно ли он ввел?
|
|
|

13.03.2023, 22:41
|
|
Познавший АНТИЧАТ
Регистрация: 31.07.2021
Сообщений: 1,784
С нами:
2520168
Репутация:
133
|
|
Как вывести сообщение в консоль сф? если в луа это просто print()
|
|
|

13.03.2023, 23:05
|
|
Познавший АНТИЧАТ
Регистрация: 18.09.2017
Сообщений: 1,044
С нами:
4553429
Репутация:
153
|
|
Сообщение от kjor32
Как вывести сообщение в консоль сф? если в луа это просто print()
C++:
Код:
SF
->
Log
(
"Hello"
)
;
|
|
|

14.03.2023, 01:52
|
|
Новичок
Регистрация: 10.07.2019
Сообщений: 6
С нами:
3602609
Репутация:
51
|
|
Приветствую, подскажите как удалить лишние пункты из меню esc samp через asi? Source code
|
|
|

17.03.2023, 12:51
|
|
Новичок
Регистрация: 10.07.2019
Сообщений: 6
С нами:
3602609
Репутация:
51
|
|
Сообщение от Dzho_Handerson
Приветствую, подскажите как удалить лишние пункты из меню esc через asi?
up
|
|
|

17.03.2023, 13:10
|
|
Новичок
Регистрация: 17.03.2023
Сообщений: 8
С нами:
1665045
Репутация:
3
|
|
Сообщение от Dzho_Handerson
up
Привет.
- Скачай и установи библиотеку Cleo 4
- Создай новую папку внутри папки "CLEO" и назови ее "CLEO_TEXT"
- В папке "CLEO_TEXT" создай новый файл с именем "MENU" и расширением ".fxt"
- Открой созданный файл с помощью любого текстового редактора и добавь в него строки в формате: $REMOVE_TEXT_FROM_ESC "Название пункта меню, который нужно удалить" (Пример: $REMOVE_TEXT_FROM_ESC "Audio Settings")
Ну и в принципе всё, сохрани файл и зайди в игру, должны пропасть
|
|
|

25.03.2023, 23:21
|
|
Новичок
Регистрация: 10.07.2019
Сообщений: 6
С нами:
3602609
Репутация:
51
|
|
Сообщение от Dzho_Handerson
Приветствую, подскажите как удалить лишние пункты из меню esc samp через asi?
UP
|
|
|

01.04.2023, 03:31
|
|
Новичок
Регистрация: 10.07.2019
Сообщений: 6
С нами:
3602609
Репутация:
51
|
|
Сообщение от Dzho_Handerson
Приветствую, подскажите как удалить лишние пункты из меню esc samp через asi? Source code
Up
|
|
|
|
 |
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|