Неправильный ввод команды в чат

timurozcan2

Участник
Автор темы
55
2
Версия SA-MP
  1. 0.3.7-R3
Короче в видео все рассказал.


BarjBind.lua:
script_author("barjik")
script_name("barjbind")

require "lib.moonloader"
local keys = require "vkeys"

local tag = "{FFD700}BarjBind {FFFFFF}for{DC143C} ARZ {008000}Loaded"
local main_color = 0x0000FF

function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
      while not isSampAvailable() do wait(100) end
      sampAddChatMessage("" .. tag, main_color)
      while true do
      wait(0)

    if isKeyJustPressed(VK_L) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/lock") end

    if isKeyJustPressed(VK_7) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/bcl") end

    if isKeyJustPressed(VK_B) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/opengate") end
    
     if isKeyJustPressed(VK_K) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/key") end

      if isKeyJustPressed(VK_J) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/time") end

       if isKeyJustPressed(VK_1) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/usemed") end
        
        if isKeyJustPressed(VK_X) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/style") end

         if isKeyJustPressed(VK_9) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/mask") end

          if isKeyJustPressed(VK_0) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/balloon") end

         if isKeyJustPressed(VK_4) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/armour") end
  
        if isKeyJustPressed(VK_3) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/anim 3") end
              
       if isKeyDown(VK_MENU) and isKeyJustPressed(VK_NUMPAD1) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/usedrugs 1") end

      if isKeyDown(VK_MENU) and isKeyJustPressed(VK_NUMPAD2) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/usedrugs 2") end
    
     if isKeyDown(VK_MENU) and isKeyJustPressed(VK_NUMPAD3) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/usedrugs 3") end

    if isKeyDown(VK_RBUTTON) and isKeyJustPressed(VK_R) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/repcar") end
   if isKeyDown(VK_RBUTTON) and isKeyJustPressed(VK_2) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampSendChat("/fillcar") end
end
end


 

Rice.

https://t.me/riceoff
Модератор
1,673
1,360
Доброго времени суток!
Проблема в том, что зарегистрированные команды другим скриптом нельзя активировать с помощью sampSendChat('text').
Для их ввода нужно использовать sampProcessChatInput('text').
Пример:
Lua:
if isKeyDown(VK_RBUTTON) and isKeyJustPressed(VK_2) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampProcessChatInput('/bcl') end
 
  • Нравится
Реакции: timurozcan2 и b1coo

timurozcan2

Участник
Автор темы
55
2
Доброго времени суток!
Проблема в том, что зарегистрированные команды другим скриптом нельзя активировать с помощью sampSendChat('text').
Для их ввода нужно использовать sampProcessChatInput('text').
Пример:
Lua:
if isKeyDown(VK_RBUTTON) and isKeyJustPressed(VK_2) and not sampIsChatInputActive() and not sampIsDialogActive() and not isPauseMenuActive() and not isSampfuncsConsoleActive() then sampProcessChatInput('/bcl') end
Спасибо большое, буду знать!