- 3
- 0
- Версия SA-MP
-
- 0.3.7-R3
Просьба переделать sampRegisterChatCommand на то, чтобы скрипт можно было открывать по нажатию клавиши (либо PAUSE/BREAK, либо XBUTTON1 либо XBUTTON2), буду весьма благодарен. Также было бы славно если при заходе на сервер будет надпись "AFK without ESC loaded".
Lua:
require 'lib.moonloader'
require 'sampfuncs'
require 'vkeys'
local memory = require 'memory'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local svWork = false
local arr = {}
function main()
if not isSampLoaded() and not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('sv', sv)
wait(-1)
end
function sv()
svWork = not svWork
lockPlayerControl(svWork)
if svWork then
memory.write(0x747FB6, 0x1, 1, true)
memory.write(0x74805A, 0x1, 1, true)
memory.fill(0x74542B, 0x90, 8, true)
memory.fill(0x53EA88, 0x90, 6, true)
sampAddChatMessage('AFK on', -1)
else
memory.write(0x747FB6, 0x0, 1, true)
memory.write(0x74805A, 0x0, 1, true)
arr = { 0x50, 0x51, 0xFF, 0x15, 0x00, 0x83, 0x85, 0x00 }
memset(0x74542B)
arr = { 0x0F, 0x84, 0x7B, 0x01, 0x00, 0x00 }
memset(0x53EA88)
sampAddChatMessage('AFK off', -1)
end
end
function memset(addr)
for i = 1, #arr do
memory.write(addr + i - 1, arr[i], 1, true)
end
end