local Commands = {};
Commands.PanzerSend = {};

Commands.PanzerSend.EngineStart = function(player, args)
    local vehicle = getVehicleById(args.vehicleId)
    if vehicle then
        if true or vehicle:isEngineWorking() then
            vehicle:tryStartEngine(true)
        end
    end
end

Commands.PanzerSend.Update = function(player, args)
    local vehicle = getVehicleById(args.vehicleId)
    local modData = vehicle:getModData()
    local CrewLevelNow = args.CrewLevelNow
    local CrewPoint = args.CrewPoint
    local CrewLevel = args.CrewLevel
    local researchTable = args.researchTable
    local researchPoint = args.researchPoint
    local CrewKillNum = args.CrewKillNum
    modData.CrewLevelNow = CrewLevelNow
    modData.CrewPoint = CrewPoint
    modData.CrewLevel = CrewLevel
    modData.researchTable = researchTable
    modData.researchPoint = researchPoint
    modData.CrewKillNum = CrewKillNum
    local SendPlayerTable = args.SendPlayerTable
    if getWorld():getGameMode() == "Multiplayer" then
        local OnlinePlayers = getOnlinePlayers()
        for i = 0, OnlinePlayers:size() - 1 do
            local PlayerNow = OnlinePlayers:get(i)
            local username = PlayerNow:getUsername()
            for i = 1, #SendPlayerTable do
                if username == SendPlayerTable[i] then
                    sendServerCommand(PlayerNow, "PanzerSendSendAll", "Update", {
                        vehicleId = args.vehicleId,
                        CrewLevelNow = CrewLevelNow,
                        CrewPoint = CrewPoint,
                        CrewLevel = CrewLevel,
                        researchTable = researchTable,
                        researchPoint = researchPoint,
                        CrewKillNum = CrewKillNum
                    })
                end
            end
        end
    end
end

Commands.PanzerSend.setNotHotwired = function(player, args)
    local vehicle = getVehicleById(args.vehicleId)
    if vehicle then
        vehicle:cheatHotwire(false, false)
    end
end
Commands.PanzerSend.AddLocalTest = function(player, args)
    sendServerCommand("PanzerSendSendAll", "AddLocalTest", {})
end
local onClientCommand = function(module, command, player, args)
    if Commands[module] and Commands[module][command] then
        Commands[module][command](player, args);
    end
end

Events.OnClientCommand.Add(onClientCommand);

