Creating-commands

From FiveM Wikipedia

Создание команд

RegisterCommand

Рекомендуется всегда использовать это (и не!), так как это позволяет использовать интегрированную систему ACL и другие основные функции (автоматическое завершение, использование консоли, ...). Этот собственный компонент состоит из 3 параметров ([string], [func] и [boolean]).chatMessagecommandNamehandlerrestricted

Пример

RegisterCommand("commandName", function(source --[[ this is the player ID (on the server): a number ]], args --[[ this is a table of the arguments provided ]], rawCommand --[[ this is what the user entered ]])
    if source > 0 then
        print("You are not console.")
    else
        print("This is console!")
    end
end, true) -- this true bool means that the user cannot execute the command unless they have the 'command.commandName' ACL object allowed to one of their identifiers.

Другие примеры можно найти в соответствующих введениях Lua и C#.


Миграция из устаревших методов