Не работает скрипт

Toha22

Новичок
Автор темы
1
0
Версия MoonLoader
.026-beta
Привет! Кое как по лютейшим гайдам решил написать первый собственный скрипт, но он не работает хз почему.
Lua:
local sampev = require 'samp.events'
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8

local SCRIPT_NAME = "Motor Raznos by Anticrips"
local VERSION = "1.0"
local COLOR_BLUE = 0x1E90FFF
local antistunActive = false

function main()

    while not isSampAvailable() do wait(100) end
   
    sampAddChatMessage(u8(SCRIPT_NAME .. "[/as]"), COLOR_BLUE)
   
    sampRegisterChatCommand("as", showDialog)
    
    while true do
        wait(0)
       
        if isKeyJustPressed(VK_U) then
            toggleAntistun()
        elseif isKeyJustPressed(VK_I) then
            giveDeagle()
        elseif isKeyJustPressed(VK_O) then
            giveM4()
        end
    end
end

function showDialog()
    sampShowDialog(1000, u8"Anticrips Menu", u8"Antistun активация/деактивация - U\nВыдача 50 пт Desert Eagle - I\nВыдача 100 пт M4 - O", u8"Закрыть", "", 0)
end

function toggleAntistun()
    antistunActive = not antistunActive
    if antistunActive then
        runSampfuncsConsoleCommand("op 0946:$player_actor 1")
        sampAddChatMessage(u8"[MZ] Antistun Active", COLOR_BLUE)
    else
        runSampfuncsConsoleCommand("op 0946:$player_actor 0")
        sampAddChatMessage(u8"[MZ] Antistun Deactivated", COLOR_BLUE)
    end
end

function giveDeagle()
    runSampfuncsConsoleCommand("01b2:$player_actor 24 50")
    sampAddChatMessage(u8"[MZ] Выдано 50 Дигла", COLOR_BLUE)
end

function giveM4()
    runSampfuncsConsoleCommand(01b2:$player_actor 31 100")
    sampAddChatMessage(u8"[MZ] Выдано 100 Арабки", COLOR_BLUE)
end

main()
 
Последнее редактирование: