Нужна помощь с lua скриптом

MrEnderStail

Новичок
Автор темы
19
0
Версия SA-MP
  1. 0.3.7 (R1)
  2. 0.3.7-R2
  3. 0.3.7-R3
  4. 0.3.7-R4
Такая проблема : скрипт ниже, в мунлоадере пишет такое : ".luac:31: 'end' expected (to close 'while' at line 11) near '<eof>'" однако мне нужно закрыть 28 а не 11 я уже куда только не пеереносил нижний код оно никак не помогает.Зарание спасибо
Lua:
script_name("Test CMD") 
script_version_number(228)
script_version("1.0")
script_authors("no")

  function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    active = 0
    sampRegisterChatCommand("farm", Hello)
    while true do
        wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
          if active == 1 then
            local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
               local result, id = sampGetPlayerIdByCharHandle(ped)
               if result then
               sampSendChat("/jobinvite" ..id)
           end
        end
    end
  end   
 
 
 
 
 function activatecmd()
   if active == 0 then
       active = 1
   else
       active = 0
     end
    end
 
Решение
Lua:
script_name("Test CMD")
script_version_number(228)
script_version("1.0")
script_authors("no")

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    active = 0
    sampRegisterChatCommand("farm", activatecmd)
    while true do
        wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
          if active == 1 then
            local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
               local result, id = sampGetPlayerIdByCharHandle(ped)
               if result then
                sampSendChat("/jobinvite " ..id)
               end
           end
        end...

sᴀxᴏɴ

#Mary
Всефорумный модератор
791
846
Lua:
script_name("Test CMD")
script_version_number(228)
script_version("1.0")
script_authors("no")

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    active = 0
    sampRegisterChatCommand("farm", Hello)
    while true do
        wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
          if active == 1 then
            local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
               local result, id = sampGetPlayerIdByCharHandle(ped)
               if result then
                sampSendChat("/jobinvite" ..id)
               end
           end
        end
    end
  end
end 
 
 
 
 
 function activatecmd()
   if active == 0 then
       active = 1
   else
       active = 0
     end
    end
 

MrEnderStail

Новичок
Автор темы
19
0
Lua:
script_name("Test CMD")
script_version_number(228)
script_version("1.0")
script_authors("no")

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    active = 0
    sampRegisterChatCommand("farm", Hello)
    while true do
        wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
          if active == 1 then
            local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
               local result, id = sampGetPlayerIdByCharHandle(ped)
               if result then
                sampSendChat("/jobinvite" ..id)
               end
           end
        end
    end
  end
end




function activatecmd()
   if active == 0 then
       active = 1
   else
       active = 0
     end
    end
вот всё скопировал но при нажатии пкм и наведении на человека нихуя не происходит ( команды для вкл написал )
 

sᴀxᴏɴ

#Mary
Всефорумный модератор
791
846
Lua:
script_name("Test CMD")
script_version_number(228)
script_version("1.0")
script_authors("no")

function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    active = 0
    sampRegisterChatCommand("farm", activatecmd)
    while true do
        wait(0)
        if not isPauseMenuActive() and isPlayerPlaying(playerHandle) then
          if active == 1 then
            local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
            if valid and doesCharExist(ped) then
               local result, id = sampGetPlayerIdByCharHandle(ped)
               if result then
                sampSendChat("/jobinvite " ..id)
               end
           end
        end
    end
  end
end




function activatecmd()
   if active == 0 then
       active = 1
   else
       active = 0
     end
    end
 
  • Нравится
Реакции: MrEnderStail