attempt to get length of local 'arg' (a nil value)

Markelov9999

Участник
Автор темы
73
2
Версия MoonLoader
.026-beta
Приветствую.

В чем ошибка?
Lua:
function cmd_phh(text, arg)
        if sampGetPlayerNickname(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))) == 'Leon_Markelov' then
            if #text == 0 then
                sampAddChatMessage('{00aaff}[Admin Tools]{ffffff}: Введите корректный {00aaff}никнейм администратора{ffffff}.')
            else
                if #arg == 0 then
                    sampAddChatMessage('{00aaff}[Admin Tools]{ffffff}: Введите корректный {00aaff}уровень администратора{ffffff}.')
                else
                    if #arg == 1 then
                        sampSendChat('/makeadmin ' ..text.. ' 0')
                        wait(2000)
                        sampSendChat('/offwarn ' ..text.. ' Снят | Администратор ' ..arg.. ' lvl')
                        wait(2000)
                        sampSendChat('/offban ' ..text.. ' 30 Снят | Администратор ' ..arg.. ' lvl')
                        wait(2000)
                        sampSendChat('/aad Администратор ' ..text.. ' снят со своего поста, пожелаем ему удачи!')
                        wait(2000)
                        sampSendChat('/aad Приятной игры на ' ..servername.. '.')
                    else
                        sampAddChatMessage('Кря')
                    end
                end
            end
        else
        sampAddChatMessage('{00aaff}[Admin Tools]{ffffff}: Команда доступна от должности {00aaff}Главный администратор{ffffff}!')
        end

end