не работает луа при запуске сампа

parkinson

Участник
Автор темы
33
1
1608150855985.png

при запуске сампа нет не одного признака жизни скрипта что делать???второй час прыгаю с танцами у пк
 
Решение
Lua:
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = '[My First Script]:' -- локальная переменная
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvaible() do wait(100) end
 
    sampRegisterChatCommand("imgui", cmd_imgui)
 
    _, id - sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = SampGetPlayerNickname(id)
 
    imgui.Process - true
 
    while true do
    wait(0)
 
    if isKeyJustPressed(VK_F3) then
    sampAddChatMessage("Вы нажали клавишу {FFFFFF}F3."...

parkinson

Участник
Автор темы
33
1
Lua:
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = '[My First Script]:' -- локальная переменная
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvaible() do wait(100) end
   
    sampRegisterChatCommand("imgui", cmd_imgui)
   
    _, id - sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = SampGetPlayerNickname(id)
   
    imgui.Process - true
   
    while true do
    wait(0)
   
    if isKeyJustPressed(VK_F3) then
    sampAddChatMessage("Вы нажали клавишу {FFFFFF}F3." ..main_color_text .. "Ваш ник: {FFFFFF} .. nick .. ", " .. main_color_text .. "ваш ID: {FFFFFF}" .. id, main_color)
    end
   
    if isKeyDown(VK_MENU) and isKeyJustPressed(VK_9) then
    sampAddChatMessage("Вы нажали комбинацию клавиш!", main_color)
    wait(500)
    sampAddChatMessage("Прошло пол секунды", main_color)
    end

end
end

function cmd_imgui(arg)

end

function imgui.OnDrawFrame()
imgui.Begin("Start imgui")
imgui.Test("Some text")
imgui.End()
end
 

sᴀxᴏɴ

спокойно, мне похуй
Всефорумный модератор
787
846
Lua:
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8

local tag = '[My First Script]:' -- локальная переменная
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvaible() do wait(100) end
 
    sampRegisterChatCommand("imgui", cmd_imgui)
 
    _, id - sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = SampGetPlayerNickname(id)
 
    imgui.Process - true
 
    while true do
    wait(0)
 
    if isKeyJustPressed(VK_F3) then
    sampAddChatMessage("Вы нажали клавишу {FFFFFF}F3." ..main_color_text .. "Ваш ник: {FFFFFF} .. nick .. ", " .. main_color_text .. "ваш ID: {FFFFFF}" .. id, main_color)
    end
 
    if isKeyDown(VK_MENU) and isKeyJustPressed(VK_9) then
    sampAddChatMessage("Вы нажали комбинацию клавиш!", main_color)
    wait(500)
    sampAddChatMessage("Прошло пол секунды", main_color)
    end

end
end

function cmd_imgui(arg)

end

function imgui.OnDrawFrame()
imgui.Begin("Start imgui")
imgui.Test("Some text")
imgui.End()
end

сделать 7 ошибок в коде из гайда - это, наверное, рекорд
Lua:
local keys = require "vkeys"
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local moonloader = require('moonloader')

local tag = '[My First Script]:' -- локальная переменная
local label = 0
local main_color = 0x5A90CE
local main_color_text = "{5A90CE}"
local white_color = "{FFFFFF}"

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
 
    sampRegisterChatCommand("imgui", cmd_imgui)
 
    _, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
    nick = sampGetPlayerNickname(id)
 
    imgui.Process = true
 
    while true do
    wait(0)
 
    if isKeyJustPressed(VK_F3) then
    sampAddChatMessage("Вы нажали клавишу {FFFFFF}F3. " ..main_color_text .. "Ваш ник: {FFFFFF}" .. nick .. ", " .. main_color_text .. "ваш ID: {FFFFFF}" .. id, main_color)
    end
 
    if isKeyDown(VK_MENU) and isKeyJustPressed(VK_9) then
    sampAddChatMessage("Вы нажали комбинацию клавиш!", main_color)
    wait(500)
    sampAddChatMessage("Прошло пол секунды", main_color)
    end

end
end

function cmd_imgui(arg)

end

function imgui.OnDrawFrame()
imgui.Begin("Start imgui")
imgui.Text("Some text")
imgui.End()
end
 
Последнее редактирование: