SA:MP Помощь со скриптом

JokerEnergy

Новичок
Автор темы
8
0
Версия SA-MP
  1. Любая
Может кто-нибудь написать простенький скрипт?

Суть скрипта: если вас свапает админ или телепортирует, то скрипт автоматически нажимает клавишу Z.
 
Решение
Lua:
local hook = require("lib.samp.events")
require("lib.moonloader")
function hook.onSetPlayerPos(pos)
    local myPos = {getCharCoordinates(1)}
    if myPos[1] == pos.x and myPos[2] == pos.y and myPos[3] ~= pos.z then
        pressZ()
    end
end
function hook.onServerMessage(color, text)
    if text:find("телепортировал вас") then
        pressZ()
    end
end
function pressZ()
    lua_thread.create(function()
        setVirtualKeyDown(VK_Z, true)
        wait(50)
        setVirtualKeyDown(VK_Z, false)
    end)
end

Dimon7724

Участник
32
3

VanoKLR

Известный
999
625
Lua:
local hook = require("lib.samp.events")
require("lib.moonloader")
function hook.onSetPlayerPos(pos)
    local myPos = {getCharCoordinates(1)}
    if myPos[1] == pos.x and myPos[2] == pos.y and myPos[3] ~= pos.z then
        pressZ()
    end
end
function hook.onServerMessage(color, text)
    if text:find("телепортировал вас") then
        pressZ()
    end
end
function pressZ()
    lua_thread.create(function()
        setVirtualKeyDown(VK_Z, true)
        wait(50)
        setVirtualKeyDown(VK_Z, false)
    end)
end
 
  • Нравится
Реакции: JokerEnergy