lua:sampfuncsregisterconsolecommand

sampfuncsRegisterConsoleCommand

Опкод 0C63.
Требования: SAMPFUNCS.

bool result = sampfuncsRegisterConsoleCommand(string cmd, function func)

Добавляет новую команду в консоль SAMPFUNCS. От оригинального опкода отличается дополнительн

string cmd команда
function func функция-обработчик

bool result результат выполнения

function main()
  if not isSampfuncsLoaded() then return end
  sampfuncsRegisterConsoleCommand("mycmd", conCommandMycmd)
  wait(-1)
end
 
function conCommandMycmd(arg)
  if #arg == 0 then
    print("Command 'mycmd' syntax: /mycmd [something]")
  else
    print("MyCmd: input = " .. arg)
  end
end